Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Config / Entity / ConfigEntityType.php
index 11c9ff1bf093005fc75e20bb51d9fc1aef5a25fa..3f142dfed40a7d89c25c9a3d2142a25c03b87eb8 100644 (file)
@@ -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;
   }
 
   /**