diff --git a/core/lib/Drupal/Core/Config/TypedConfigManager.php b/core/lib/Drupal/Core/Config/TypedConfigManager.php index 64735ad..71aa0bc 100644 --- a/core/lib/Drupal/Core/Config/TypedConfigManager.php +++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php @@ -11,11 +11,12 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Utility\NestedArray; use Drupal\Component\Utility\String; +use Drupal\Core\Config\TypedConfigManagerInterface; /** * Manages config type plugins. */ -class TypedConfigManager extends PluginManagerBase { +class TypedConfigManager extends PluginManagerBase implements TypedConfigManagerInterface { /** * A storage controller instance for reading configuration data. @@ -285,4 +286,14 @@ protected function replaceVariable($value, $data) { } } + /** + * {@inheritdoc} + */ + public function hasConfigSchema($name) { + // The schema system falls back on the Property class for unknown types. + // See http://drupal.org/node/1905230 + $definition = $this->getDefinition($name); + return is_array($definition) && ($definition['class'] != '\Drupal\Core\Config\Schema\Property'); + } + } diff --git a/core/lib/Drupal/Core/Config/TypedConfigManagerInterface.php b/core/lib/Drupal/Core/Config/TypedConfigManagerInterface.php new file mode 100644 index 0000000..e80f569 --- /dev/null +++ b/core/lib/Drupal/Core/Config/TypedConfigManagerInterface.php @@ -0,0 +1,27 @@ +assertIdentical(FALSE, config_typed()->hasConfigSchema('config_test.no_such_key')); $definition = config_typed()->getDefinition('config_test.no_such_key'); $expected = array(); $expected['label'] = 'Unknown'; @@ -51,10 +52,12 @@ function testSchemaMapping() { $this->assertEqual($definition, $expected, 'Retrieved the right metadata for nonexistent configuration.'); // Configuration file without schema will return Unknown as well. + $this->assertIdentical(FALSE, config_typed()->hasConfigSchema('config_test.noschema')); $definition = config_typed()->getDefinition('config_test.noschema'); $this->assertEqual($definition, $expected, 'Retrieved the right metadata for configuration with no schema.'); // Configuration file with only some schema. + $this->assertIdentical(TRUE, config_typed()->hasConfigSchema('config_test.someschema')); $definition = config_typed()->getDefinition('config_test.someschema'); $expected = array(); $expected['label'] = 'Schema test data';