X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FConfig%2FEntity%2FConfigEntityType.php;h=3f142dfed40a7d89c25c9a3d2142a25c03b87eb8;hb=refs%2Fheads%2Fd864;hp=11c9ff1bf093005fc75e20bb51d9fc1aef5a25fa;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php b/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php index 11c9ff1bf..3f142dfed 100644 --- a/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php +++ b/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php @@ -142,30 +142,40 @@ class ConfigEntityType extends EntityType implements ConfigEntityTypeInterface { /** * {@inheritdoc} */ - public function getPropertiesToExport() { + public function getPropertiesToExport($id = NULL) { + if (!empty($this->mergedConfigExport)) { + return $this->mergedConfigExport; + } if (!empty($this->config_export)) { - if (empty($this->mergedConfigExport)) { - // Always add default properties to be exported. - $this->mergedConfigExport = [ - 'uuid' => 'uuid', - 'langcode' => 'langcode', - 'status' => 'status', - 'dependencies' => 'dependencies', - 'third_party_settings' => 'third_party_settings', - '_core' => '_core', - ]; - foreach ($this->config_export as $property => $name) { - if (is_numeric($property)) { - $this->mergedConfigExport[$name] = $name; - } - else { - $this->mergedConfigExport[$property] = $name; - } + // Always add default properties to be exported. + $this->mergedConfigExport = [ + 'uuid' => 'uuid', + 'langcode' => 'langcode', + 'status' => 'status', + 'dependencies' => 'dependencies', + 'third_party_settings' => 'third_party_settings', + '_core' => '_core', + ]; + foreach ($this->config_export as $property => $name) { + if (is_numeric($property)) { + $this->mergedConfigExport[$name] = $name; + } + else { + $this->mergedConfigExport[$property] = $name; } } - return $this->mergedConfigExport; } - return NULL; + else { + // @todo https://www.drupal.org/project/drupal/issues/2949021 Deprecate + // fallback to schema. + $config_name = $this->getConfigPrefix() . '.' . $id; + $definition = \Drupal::service('config.typed')->getDefinition($config_name); + if (!isset($definition['mapping'])) { + return NULL; + } + $this->mergedConfigExport = array_combine(array_keys($definition['mapping']), array_keys($definition['mapping'])); + } + return $this->mergedConfigExport; } /**