TypedConfigManager::alterDefinitions

protected TypedConfigManager::alterDefinitions(&$definitions)

Invokes the hook to alter the definitions if the alter hook is set.

Parameters

$definitions: The discovered plugin definitions.

Overrides DefaultPluginManager::alterDefinitions

File

core/lib/Drupal/Core/Config/TypedConfigManager.php, line 358

Class

TypedConfigManager
Manages config schema type plugins.

Namespace

Drupal\Core\Config

Code

protected function alterDefinitions(&$definitions) {
  $discovered_schema = array_keys($definitions);
  parent::alterDefinitions($definitions);
  $altered_schema = array_keys($definitions);
  if ($discovered_schema != $altered_schema) {
    $added_keys = implode(',', array_diff($altered_schema, $discovered_schema));
    $removed_keys = implode(',', array_diff($discovered_schema, $altered_schema));
    if (!empty($added_keys) && !empty($removed_keys)) {
      $message = "Invoking hook_config_schema_info_alter() has added ($added_keys) and removed ($removed_keys) schema definitions";
    }
    elseif (!empty($added_keys)) {
      $message = "Invoking hook_config_schema_info_alter() has added ($added_keys) schema definitions";
    }
    else {
      $message = "Invoking hook_config_schema_info_alter() has removed ($removed_keys) schema definitions";
    }
    throw new ConfigSchemaAlterException($message);
  }
}
doc_Drupal
2016-10-29 09:49:54
Comments
Leave a Comment

Please login to continue.