Skip to content
Snippets Groups Projects
Commit 56580a39 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #1889854 by tim.plunkett: Fixed Config import breaks on protected entity properties.

parent a1ce6942
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -470,11 +470,11 @@ public function importChange($name, Config $new_config, Config $old_config) {
$entity->original = clone $entity;
foreach ($old_config->get() as $property => $value) {
$entity->original->$property = $value;
$entity->original->set($property, $value);
}
foreach ($new_config->get() as $property => $value) {
$entity->$property = $value;
$entity->set($property, $value);
}
$entity->save();
......
......@@ -108,6 +108,7 @@ function testNew() {
'label' => 'New',
'style' => '',
'langcode' => 'und',
'protected_property' => '',
);
$staging->write($dynamic_name, $original_dynamic_data);
......
......@@ -60,6 +60,7 @@ function testImport() {
'label' => 'New',
'style' => '',
'langcode' => 'und',
'protected_property' => '',
);
$staging->write($dynamic_name, $original_dynamic_data);
......
id: default
label: Default
protected_property: Default
......@@ -62,4 +62,25 @@ class ConfigTest extends ConfigEntityBase {
*/
public $style;
/**
* A protected property of the configuration entity.
*
* @var string
*/
protected $protected_property;
/**
* Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::getExportProperties();
*/
public function getExportProperties() {
$properties = parent::getExportProperties();
$protected_names = array(
'protected_property',
);
foreach ($protected_names as $name) {
$properties[$name] = $this->get($name);
}
return $properties;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment