diff --git a/core/config/schema/core.entity.schema.yml b/core/config/schema/core.entity.schema.yml index 07e4714..60c4635 100644 --- a/core/config/schema/core.entity.schema.yml +++ b/core/config/schema/core.entity.schema.yml @@ -70,6 +70,9 @@ core.entity_view_display.*.*.*: settings: type: field.formatter.settings.[%parent.type] label: 'Settings' + settings_langcode: + type: string + label: 'Language code for settings' third_party_settings: type: sequence label: 'Third party settings' @@ -123,6 +126,9 @@ core.entity_form_display.*.*.*: label: 'Third party settings' sequence: type: field.widget.third_party.[%key] + settings_langcode: + type: string + label: 'Language code for settings' hidden: type: sequence label: 'Hidden' diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php index 3a59e01..8db6163 100644 --- a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -346,8 +346,13 @@ public function setComponent($name, array $options = array()) { $options = $this->pluginManager->prepareConfiguration($field_definition->getType(), $options); } - // Ensure we always have an empty settings and array. - $options += ['settings' => [], 'third_party_settings' => []]; + // Ensure we always have an empty settings, third_party_settings, and + // settings_langcode if not provided. + $options += [ + 'settings' => [], + 'third_party_settings' => [], + 'settings_langcode' => NULL, + ]; $this->content[$name] = $options; unset($this->hidden[$name]); diff --git a/core/lib/Drupal/Core/Field/FormatterBase.php b/core/lib/Drupal/Core/Field/FormatterBase.php index 41f8701..7b9bdce 100644 --- a/core/lib/Drupal/Core/Field/FormatterBase.php +++ b/core/lib/Drupal/Core/Field/FormatterBase.php @@ -32,6 +32,13 @@ protected $settings; /** + * The language code for the formatter settings. + * + * @var string + */ + protected $settingsLangcode; + + /** * The label display setting. * * @var string diff --git a/core/lib/Drupal/Core/Field/FormatterPluginManager.php b/core/lib/Drupal/Core/Field/FormatterPluginManager.php index d100add..d29d101 100644 --- a/core/lib/Drupal/Core/Field/FormatterPluginManager.php +++ b/core/lib/Drupal/Core/Field/FormatterPluginManager.php @@ -61,8 +61,10 @@ public function createInstance($plugin_id, array $configuration = array()) { $plugin_definition = $this->getDefinition($plugin_id); $plugin_class = DefaultFactory::getPluginClass($plugin_id, $plugin_definition); - // @todo Not sure we need to keep that, there should always be a settings_langcode set ? - $configuration += ['settings_langcode' => NULL]; + // @todo TEST CODE; REMOVE BEFORE COMMIT + if (!array_key_exists('settings_langcode', $configuration)) { + throw new \Exception('$configuration[settings_langcode] is missing in ' . $plugin_class); + } // @todo This is copied from \Drupal\Core\Plugin\Factory\ContainerFactory. // Find a way to restore sanity to @@ -155,6 +157,7 @@ public function prepareConfiguration($field_type, array $configuration) { 'label' => 'above', 'settings' => array(), 'third_party_settings' => array(), + 'settings_langcode' => NULL, ); // If no formatter is specified, use the default formatter. if (!isset($configuration['type'])) { diff --git a/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.default.yml b/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.default.yml index 58e360f..5e7c967 100644 --- a/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.default.yml +++ b/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.default.yml @@ -11,6 +11,7 @@ content: weight: 1 settings: { } third_party_settings: { } + settings_langcode: null label: inline image: weight: 2 @@ -21,6 +22,7 @@ content: weight: 4 settings: { } third_party_settings: { } + settings_langcode: null label: inline feed_icon: weight: 5