/**
* {@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;
}
/**