diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml index ea67e43..210b151 100644 --- a/core/config/schema/core.data_types.schema.yml +++ b/core/config/schema/core.data_types.schema.yml @@ -427,6 +427,143 @@ field.string.value: type: string label: 'Value' + +# Schema for the String (long) field type. + +field.string_long.settings: + type: sequence + label: 'String (long) settings' + sequence: + - type: string + +field.string_long.instance_settings: + type: sequence + label: 'String (long) settings' + sequence: + - type: string + label: 'Setting' + +field.string_long.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default' + mapping: + value: + type: string + label: 'Value' + +# Schema for the URI field type. + +field.uri.settings: + type: sequence + label: 'URI settings' + sequence: + - type: string + +field.uri.instance_settings: + type: sequence + label: 'URI settings' + sequence: + - type: string + label: 'Setting' + +field.uri.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default' + mapping: + value: + type: string + label: 'Value' + +# Schema for the Created field type. + +field.created.settings: + type: sequence + label: 'Created timestamp settings' + sequence: + - type: string + +field.created.instance_settings: + type: sequence + label: 'Created timestamp settings' + sequence: + - type: string + label: 'Setting' + +field.created.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default' + mapping: + value: + type: string + label: 'Value' + +# Schema for the Created field type. + +field.changed.settings: + type: sequence + label: 'Changed timestamp settings' + sequence: + - type: string + +field.changed.instance_settings: + type: sequence + label: 'Changed timestamp settings' + sequence: + - type: string + label: 'Setting' + +field.changed.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default' + mapping: + value: + type: string + label: 'Value' + +# Schema for the configuration files of the Entity refeference field type. + +field.entity_reference.settings: + type: mapping + label: 'Entity reference settings' + mapping: + target_type: + type: string + label: 'Type of item to reference' + +field.entity_reference.instance_settings: + type: mapping + label: 'Entity reference settings' + mapping: + handler: + type: string + label: 'Reference method' + handler_settings: + type: entity_reference.[%parent.handler].handler_settings + label: 'Reference method settings' + +field.entity_reference.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default' + mapping: + target_id: + type: integer + label: 'Value' + # Schema for the configuration files of the Boolean field type. field.boolean.settings: diff --git a/core/lib/Drupal/Core/Config/Schema/Element.php b/core/lib/Drupal/Core/Config/Schema/Element.php index c492d42..6f4fe9d 100644 --- a/core/lib/Drupal/Core/Config/Schema/Element.php +++ b/core/lib/Drupal/Core/Config/Schema/Element.php @@ -22,6 +22,13 @@ protected $value; /** + * The parent element object. + * + * @var Element + */ + protected $parent; + + /** * Create typed config object. */ protected function parseElement($key, $data, $definition) { @@ -37,4 +44,23 @@ protected function buildDataDefinition($definition, $value, $key) { return \Drupal::service('config.typed')->buildDataDefinition($definition, $value, $key, $this); } + /** + * Get the full config path of the element. + * + * @return string + * The full config path of the element starting with the top element key + * followed by a colon followed by element names separated with dots. + * For example: views.view.content:display.default.display_options. + */ + public function getFullName() { + if (isset($this->parent)) { + // Ensure if the parent was the root element, we do not add a dot after. + return str_replace(':.', ':', $this->parent->getFullName() . '.' . $this->getName()); + } + else { + // If there is no parent, this is the root element, add a colon. + return $this->getName() . ':'; + } + } + } diff --git a/core/lib/Drupal/Core/Config/Schema/Mapping.php b/core/lib/Drupal/Core/Config/Schema/Mapping.php index a85fac4..a8d6c53 100644 --- a/core/lib/Drupal/Core/Config/Schema/Mapping.php +++ b/core/lib/Drupal/Core/Config/Schema/Mapping.php @@ -63,7 +63,7 @@ public function get($property_name) { return $element; } else { - throw new \InvalidArgumentException(String::format("The configuration property @key doesn't exist.", array('@key' => $property_name))); + throw new \InvalidArgumentException(String::format("The configuration property @key.@element doesn't exist.", array('@key' => $this->getFullName(), '@element' => $property_name))); } } @@ -131,6 +131,11 @@ public function getPropertyDefinitions() { $this->propertyDefinitions = array(); foreach ($this->getAllKeys() as $key) { $definition = isset($this->definition['mapping'][$key]) ? $this->definition['mapping'][$key] : array(); + if (empty($definition)) { + debug($this->definition['type']); + debug($this->definition['debug']); + throw new \InvalidArgumentException(String::format("The configuration property @key.@element doesn't have schema.", array('@key' => $this->getFullName(), '@element' => $key))); + } $this->propertyDefinitions[$key] = $this->buildDataDefinition($definition, $this->value[$key], $key); } } diff --git a/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php b/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php index 0836eaf..23df176 100644 --- a/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php +++ b/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php @@ -54,7 +54,7 @@ public function checkConfigSchema(TypedConfigManagerInterface $typed_config, $co } $definition = $typed_config->getDefinition($config_name); $data_definition = $typed_config->buildDataDefinition($definition, $config_data); - $this->schema = $typed_config->create($data_definition, $config_data); + $this->schema = $typed_config->create($data_definition, $config_data, $config_name); $errors = array(); foreach ($config_data as $key => $value) { $errors = array_merge($errors, $this->checkValue($key, $value)); diff --git a/core/lib/Drupal/Core/Config/StorableConfigBase.php b/core/lib/Drupal/Core/Config/StorableConfigBase.php index 5c6e8b3..5eab003 100644 --- a/core/lib/Drupal/Core/Config/StorableConfigBase.php +++ b/core/lib/Drupal/Core/Config/StorableConfigBase.php @@ -128,7 +128,7 @@ protected function getSchemaWrapper() { if (!isset($this->schemaWrapper)) { $definition = $this->typedConfigManager->getDefinition($this->name); $data_definition = $this->typedConfigManager->buildDataDefinition($definition, $this->data); - $this->schemaWrapper = $this->typedConfigManager->create($data_definition, $this->data); + $this->schemaWrapper = $this->typedConfigManager->create($data_definition, $this->data, $this->name); } return $this->schemaWrapper; } @@ -178,7 +178,10 @@ protected function validateValue($key, $value) { protected function castValue($key, $value) { $element = $this->getSchemaWrapper()->get($key); // Do not cast value if it is unknown or defined to be ignored. - if ($element && ($element instanceof Undefined || $element instanceof Ignore)) { + if ($element && ($element instanceof Undefined)) { + throw new ConfigException(String::format("The configuration property @key is undefined.", array('@key' => $element->getFullName()))); + } + elseif ($element && ($element instanceof Ignore)) { // Do validate the value (may throw UnsupportedDataTypeConfigException) // to ensure unsupported types are not supported in this case either. $this->validateValue($key, $value); diff --git a/core/lib/Drupal/Core/Config/TypedConfigManager.php b/core/lib/Drupal/Core/Config/TypedConfigManager.php index d775cc2..1943307 100644 --- a/core/lib/Drupal/Core/Config/TypedConfigManager.php +++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php @@ -71,7 +71,7 @@ public function get($name) { $data = $this->configStorage->read($name); $type_definition = $this->getDefinition($name); $data_definition = $this->buildDataDefinition($type_definition, $data); - return $this->create($data_definition, $data); + return $this->create($data_definition, $data, $name); } /** @@ -91,7 +91,9 @@ public function buildDataDefinition(array $definition, $value, $name = NULL, $pa if (isset($name)) { $replace['%key'] = $name; } + $definition['debug']['dynamic_type'] = $type; $type = $this->replaceName($type, $replace); + $definition['debug']['resolved_type'] = $type; // Remove the type from the definition so that it is replaced with the // concrete type from schema definitions. unset($definition['type']); @@ -135,6 +137,7 @@ public function getDefinition($base_plugin_id, $exception_on_invalid = TRUE) { unset($definition['type']); $this->definitions[$type] = $definition; } + $definition['debug']['generic_type'] = $base_plugin_id; // Add type and default definition class. return $definition + array( 'definition_class' => '\Drupal\Core\TypedData\DataDefinition', diff --git a/core/modules/action/tests/action_bulk_test/action_bulk_test.info.yml b/core/modules/action/tests/action_bulk_test/action_bulk_test.info.yml index 296a33a..37b4285 100644 --- a/core/modules/action/tests/action_bulk_test/action_bulk_test.info.yml +++ b/core/modules/action/tests/action_bulk_test/action_bulk_test.info.yml @@ -7,3 +7,4 @@ core: 8.x dependencies: - action - views + - node diff --git a/core/modules/block/src/Tests/BlockLanguageTest.php b/core/modules/block/src/Tests/BlockLanguageTest.php index 18b9c39..b213766 100644 --- a/core/modules/block/src/Tests/BlockLanguageTest.php +++ b/core/modules/block/src/Tests/BlockLanguageTest.php @@ -85,7 +85,6 @@ public function testLanguageBlockVisibilityLanguageDelete() { $edit = array( 'visibility' => array( 'language' => array( - 'language_type' => 'language_interface', 'langcodes' => array( 'fr' => 'fr', ), diff --git a/core/modules/block/tests/modules/block_test/config/schema/block_test.schema.yml b/core/modules/block/tests/modules/block_test/config/schema/block_test.schema.yml new file mode 100644 index 0000000..9c0e56f --- /dev/null +++ b/core/modules/block/tests/modules/block_test/config/schema/block_test.schema.yml @@ -0,0 +1,9 @@ +# Configuration schema for block test module. + +block.settings.test_block_instantiation: + type: block_settings + label: 'Block instantiation test' + mapping: + display_message: + type: string + label: 'Message to display' diff --git a/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block.yml b/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block.yml index 8ecb8a1..2acd110 100644 --- a/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block.yml +++ b/core/modules/block/tests/modules/block_test_views/test_views/views.view.test_view_block.yml @@ -40,7 +40,7 @@ display: position: null provider: views display_options: - field: + fields: title: link_to_node: true label: test_view_block diff --git a/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php b/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php index 7a0fd65..56376a8 100644 --- a/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php +++ b/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php @@ -147,8 +147,7 @@ function testExistingFormat() { $this->drupalGet('admin/config/content/formats/manage/filtered_html'); $expected_settings['toolbar']['rows'][0][] = array( 'name' => 'Action history', - 'items' => array('Undo', '|', 'Redo'), - array('JustifyCenter') + 'items' => array('Undo', '|', 'Redo', 'JustifyCenter'), ); $edit = array( 'editor[settings][toolbar][button_groups]' => json_encode($expected_settings['toolbar']['rows']), diff --git a/core/modules/comment/src/Plugin/views/field/Link.php b/core/modules/comment/src/Plugin/views/field/Link.php index 4a3842e..43a2560 100644 --- a/core/modules/comment/src/Plugin/views/field/Link.php +++ b/core/modules/comment/src/Plugin/views/field/Link.php @@ -115,7 +115,7 @@ protected function renderLink($data, ResultRow $values) { $this->options['alter']['fragment'] = "comment-" . $cid; } // If there is no comment link to the node. - elseif ($this->options['link_to_node']) { + elseif ($this->options['link_to_entity']) { $entity = $comment->getCommentedEntity(); $this->options['alter']['path'] = $entity->getSystemPath(); } diff --git a/core/modules/entity_reference/config/schema/entity_reference.schema.yml b/core/modules/entity_reference/config/schema/entity_reference.schema.yml index 242faf3..5404963 100644 --- a/core/modules/entity_reference/config/schema/entity_reference.schema.yml +++ b/core/modules/entity_reference/config/schema/entity_reference.schema.yml @@ -1,35 +1,5 @@ # Schema for the configuration files of the Entity Reference module. -field.entity_reference.settings: - type: mapping - label: 'Entity reference settings' - mapping: - target_type: - type: string - label: 'Type of item to reference' - -field.entity_reference.instance_settings: - type: mapping - label: 'Entity reference settings' - mapping: - handler: - type: string - label: 'Reference method' - handler_settings: - type: entity_reference.[%parent.handler].handler_settings - label: 'Reference method settings' - -field.entity_reference.value: - type: sequence - label: 'Default value' - sequence: - - type: mapping - label: 'Default' - mapping: - target_id: - type: integer - label: 'Value' - entity_reference.default.handler_settings: type: mapping label: 'View handler settings' diff --git a/core/modules/field/tests/modules/field_test/config/schema/field_test.schema.yml b/core/modules/field/tests/modules/field_test/config/schema/field_test.schema.yml index f9ef7b7..6d7fb1e 100644 --- a/core/modules/field/tests/modules/field_test/config/schema/field_test.schema.yml +++ b/core/modules/field/tests/modules/field_test/config/schema/field_test.schema.yml @@ -21,3 +21,36 @@ entity_form_display.field.test_field_widget_multiple: test_widget_setting_multiple: type: string label: 'Test setting' + +field.test_field.settings: + type: mapping + label: 'Test field settings' + mapping: + test_field_storage_setting: + type: string + label: 'Storage test setting' + changeable: + type: string + label: 'Changeable setting' + unchangeable: + type: string + label: 'Unchangeable setting' + +field.test_field.instance_settings: + type: mapping + label: 'Text settings' + mapping: + test_instance_setting: + type: string + label: 'Instance setting' + +field.test_field.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default' + mapping: + value: + type: label + label: 'Value' diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItem.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItem.php index 5234964..3a9db9e 100644 --- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItem.php +++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItem.php @@ -42,7 +42,6 @@ public static function defaultSettings() { public static function defaultInstanceSettings() { return array( 'test_instance_setting' => 'dummy test string', - 'test_cached_data' => FALSE, ) + parent::defaultInstanceSettings(); } diff --git a/core/modules/node/config/install/views.view.content.yml b/core/modules/node/config/install/views.view.content.yml index 229fed6..b42a141 100644 --- a/core/modules/node/config/install/views.view.content.yml +++ b/core/modules/node/config/install/views.view.content.yml @@ -281,58 +281,6 @@ display: destination: true plugin_id: dropbutton provider: views - timestamp: - id: timestamp - table: history - field: timestamp - relationship: none - group_type: group - admin_label: '' - label: 'Has new content' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: '' - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - link_to_node: false - comments: false - plugin_id: history_user_timestamp - provider: history filters: status_extra: id: status_extra diff --git a/core/modules/node/config/install/views.view.content_recent.yml b/core/modules/node/config/install/views.view.content_recent.yml index 643ac97..8c4b605 100644 --- a/core/modules/node/config/install/views.view.content_recent.yml +++ b/core/modules/node/config/install/views.view.content_recent.yml @@ -156,58 +156,6 @@ display: link_to_node: true plugin_id: node provider: node - timestamp: - id: timestamp - table: history - field: timestamp - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: '' - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - link_to_node: false - comments: false - plugin_id: history_user_timestamp - provider: history name: id: name table: users_field_data