Commit 5b191447 authored by alexpott's avatar alexpott
Browse files

Issue #2459971 by Gábor Hojtsy: The langcode key on configuration files is not...

Issue #2459971 by Gábor Hojtsy: The langcode key on configuration files is not explicit in configuration schema
parent f35996ad
......@@ -81,6 +81,14 @@ color_hex:
# Complex extended data types:
# Root of a configuration object.
config_object:
type: mapping
mapping:
langcode:
type: string
label: 'Language code'
# Mail text with subject and body parts.
mail:
type: mapping
......@@ -121,7 +129,7 @@ action_configuration_default:
type: string
theme_settings:
type: mapping
type: config_object
mapping:
favicon:
type: mapping
......@@ -183,12 +191,6 @@ theme_settings:
sequence:
type: theme_settings.third_party.[%key]
theme_breakpoints_default:
type: sequence
sequence:
type: string
label: 'Breakpoint value'
views_field_bulk_form:
type: views_field
label: 'Bulk operation'
......@@ -262,7 +264,7 @@ config_entity:
label: 'UUID'
langcode:
type: string
label: 'Default language'
label: 'Language code'
status:
type: boolean
label: 'Status'
......@@ -416,9 +418,6 @@ core.date_format.*:
pattern:
type: date_format
label: 'PHP date format'
langcode:
type: string
label: 'Default language'
# Generic field settings schemas.
......
core.extension:
type: mapping
type: config_object
label: 'Extension settings'
mapping:
module:
......
core.menu.static_menu_link_overrides:
type: mapping
type: config_object
label: 'Static menu link overrides'
mapping:
definitions:
......
......@@ -53,7 +53,7 @@ public function checkConfigSchema(TypedConfigManagerInterface $typed_config, $co
if (!$typed_config->hasConfigSchema($config_name)) {
return FALSE;
}
$definition = $typed_config->getDefinition($config_name, TRUE, TRUE);
$definition = $typed_config->getDefinition($config_name);
$data_definition = $typed_config->buildDataDefinition($definition, $config_data);
$this->schema = $typed_config->create($data_definition, $config_data);
$errors = array();
......
......@@ -128,7 +128,7 @@ public function getStorage() {
*/
protected function getSchemaWrapper() {
if (!isset($this->schemaWrapper)) {
$definition = $this->typedConfigManager->getDefinition($this->name, TRUE, TRUE);
$definition = $this->typedConfigManager->getDefinition($this->name);
$data_definition = $this->typedConfigManager->buildDataDefinition($definition, $this->data);
$this->schemaWrapper = $this->typedConfigManager->create($data_definition, $this->data);
}
......
......@@ -72,7 +72,7 @@ public function __construct(StorageInterface $configStorage, StorageInterface $s
*/
public function get($name) {
$data = $this->configStorage->read($name);
$type_definition = $this->getDefinition($name, TRUE, TRUE);
$type_definition = $this->getDefinition($name);
$data_definition = $this->buildDataDefinition($type_definition, $data);
return $this->create($data_definition, $data);
}
......
......@@ -111,8 +111,8 @@ public function hasConfigSchema($name);
* Ignored with TypedConfigManagerInterface. Kept for compatibility with
* DiscoveryInterface.
* @param bool $is_config_name
* Set to TRUE if $plugin_id is a configuration name (as opposed to an
* internal configuration schema type).
* (deprecated) Set to TRUE if $plugin_id is a configuration name (as
* opposed to an internal configuration schema type).
*
* @return array
* A plugin definition array. If the given plugin id does not have typed
......
# Schema for the configuration files of the Action module.
action.settings:
type: mapping
type: config_object
label: 'Action settings'
mapping:
recursion_limit:
......
# Schema for the configuration files of the aggregator module.
aggregator.settings:
type: mapping
type: config_object
label: 'Aggregator settings'
mapping:
fetcher:
......
# Schema for the configuration files of the Aggregator Test module.
aggregator_test.settings:
type: mapping
type: config_object
label: 'Aggregator test settings'
mapping:
items:
......
# Schema for the configuration files of the book module.
book.settings:
type: mapping
type: config_object
label: 'Book settings'
mapping:
allowed_types:
......
color.theme.*:
type: mapping
type: config_object
label: 'Color theme settings'
mapping:
palette:
......
......@@ -61,6 +61,8 @@ function testSchemaMapping() {
$expected = array();
$expected['label'] = 'Schema test data';
$expected['class'] = '\Drupal\Core\Config\Schema\Mapping';
$expected['mapping']['langcode']['type'] = 'string';
$expected['mapping']['langcode']['label'] = 'Language code';
$expected['mapping']['testitem'] = array('label' => 'Test item');
$expected['mapping']['testlist'] = array('label' => 'Test list');
$expected['type'] = 'config_schema_test.someschema';
......@@ -101,7 +103,7 @@ function testSchemaMapping() {
'type' => 'text',
);
$expected['mapping']['langcode'] = array(
'label' => 'Default language',
'label' => 'Language code',
'type' => 'string',
);
$expected['type'] = 'system.maintenance';
......@@ -114,6 +116,10 @@ function testSchemaMapping() {
$expected['label'] = 'Ignore test';
$expected['class'] = '\Drupal\Core\Config\Schema\Mapping';
$expected['definition_class'] = '\Drupal\Core\TypedData\MapDataDefinition';
$expected['mapping']['langcode'] = array(
'type' => 'string',
'label' => 'Language code',
);
$expected['mapping']['label'] = array(
'label' => 'Label',
'type' => 'label',
......@@ -156,7 +162,7 @@ function testSchemaMapping() {
$expected['mapping']['uuid']['type'] = 'string';
$expected['mapping']['uuid']['label'] = 'UUID';
$expected['mapping']['langcode']['type'] = 'string';
$expected['mapping']['langcode']['label'] = 'Default language';
$expected['mapping']['langcode']['label'] = 'Language code';
$expected['mapping']['status']['type'] = 'boolean';
$expected['mapping']['status']['label'] = 'Status';
$expected['mapping']['dependencies']['type'] = 'config_dependencies';
......@@ -222,6 +228,8 @@ function testSchemaMapping() {
$expected = array();
$expected['label'] = 'Schema multiple filesytem marker test';
$expected['class'] = '\Drupal\Core\Config\Schema\Mapping';
$expected['mapping']['langcode']['type'] = 'string';
$expected['mapping']['langcode']['label'] = 'Language code';
$expected['mapping']['testid']['type'] = 'string';
$expected['mapping']['testid']['label'] = 'ID';
$expected['mapping']['testdescription']['type'] = 'text';
......@@ -396,6 +404,8 @@ function testSchemaFallback() {
$expected['label'] = 'Schema wildcard fallback test';
$expected['class'] = '\Drupal\Core\Config\Schema\Mapping';
$expected['definition_class'] = '\Drupal\Core\TypedData\MapDataDefinition';
$expected['mapping']['langcode']['type'] = 'string';
$expected['mapping']['langcode']['label'] = 'Language code';
$expected['mapping']['testid']['type'] = 'string';
$expected['mapping']['testid']['label'] = 'ID';
$expected['mapping']['testdescription']['type'] = 'text';
......
config_collection_install_test.test:
type: mapping
type: config_object
label: 'Collection test'
mapping:
collection:
......
config_events_test.test:
type: mapping
type: config_object
label: 'Configuration events test'
mapping:
key:
......
# Schema for the configuration files of the Configuration Integration Test module.
config_integration_test.settings:
type: mapping
type: config_object
label: 'Configuration integration test settings'
mapping:
foo:
......
# Schema for the configuration files of the Configuration Schema Test module.
config_schema_test.someschema:
type: mapping
type: config_object
label: 'Schema test data'
mapping:
testitem:
......@@ -11,7 +11,7 @@ config_schema_test.someschema:
config_schema_test.someschema.with_parents:
label: 'Schema test data with parenting'
type: mapping
type: config_object
mapping:
one_level:
label: 'Parenting one level up'
......@@ -64,7 +64,7 @@ config_schema_test.someschema.with_parents.key_3:
type: string
config_schema_test.someschema.somemodule.*.*:
type: mapping
type: config_object
label: 'Schema multiple filesytem marker test'
mapping:
testid:
......@@ -75,7 +75,7 @@ config_schema_test.someschema.somemodule.*.*:
label: 'Description'
config_schema_test.wildcard_fallback.*:
type: mapping
type: config_object
label: 'Schema wildcard fallback test'
mapping:
testid:
......@@ -86,7 +86,7 @@ config_schema_test.wildcard_fallback.*:
label: 'Description'
config_schema_test.schema_data_types:
type: mapping
type: config_object
label: 'Config test schema'
mapping:
config_schema_test_integer:
......@@ -127,7 +127,7 @@ config_schema_test.schema_data_types:
config_schema_test.schema_in_install:
label: 'Schema test data with parenting'
type: mapping
type: config_object
mapping:
integer:
type: integer
......@@ -138,7 +138,7 @@ config_schema_test_integer:
label: 'Config test integer'
config_schema_test.ignore:
type: mapping
type: config_object
label: 'Ignore test'
mapping:
label:
......@@ -155,7 +155,7 @@ config_schema_test.ignore:
label: 'Weight'
config_schema_test.plugin_types:
type: mapping
type: config_object
mapping:
tests:
type: sequence
......
......@@ -56,7 +56,7 @@ config_test.query.*:
label: 'number'
config_test.types:
type: mapping
type: config_object
label: 'Configuration type'
mapping:
array:
......@@ -94,7 +94,7 @@ config_test.types:
label: 'String integer'
config_test.no_status.default:
type: mapping
type: config_object
label: 'Configuration no status default'
mapping:
id:
......@@ -105,7 +105,7 @@ config_test.no_status.default:
label: 'Label'
config_test.system:
type: mapping
type: config_object
label: 'Configuration system'
mapping:
foo:
......@@ -119,7 +119,7 @@ config_test.system:
label: '404'
config_test.new:
type: mapping
type: config_object
label: 'Configuration test'
mapping:
key:
......@@ -136,7 +136,7 @@ config_test.old:
type: config_test.new
config_test.foo:
type: mapping
type: config_object
label: 'Configuration test'
mapping:
value:
......
# Schema for the configuration files of the Configuration translation test module.
config_translation_test.content:
type: mapping
type: config_object
label: 'Content'
mapping:
id:
......@@ -10,9 +10,6 @@ config_translation_test.content:
label:
type: label
label: 'Label'
langcode:
type: string
label: 'Default language'
content:
type: text_format
label: 'Content'
......
......@@ -24,7 +24,7 @@ contact.form.*:
label: 'Weight'
contact.settings:
type: mapping
type: config_object
label: 'Contact settings'
mapping:
default_form:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment