Commit 3b604ffa authored by webchick's avatar webchick

Issue #2162271 by likin: Prefixes in config_get_storage_names_with_prefix.

parent 42ac4e50
......@@ -2430,7 +2430,7 @@ function language_list($flags = Language::STATE_CONFIGURABLE) {
$default = language_default();
if (language_multilingual() || \Drupal::moduleHandler()->moduleExists('language')) {
// Use language module configuration if available.
$language_entities = config_get_storage_names_with_prefix('language.entity');
$language_entities = config_get_storage_names_with_prefix('language.entity.');
// Initialize default property so callers have an easy reference and can
// save the same object without data loss.
......
......@@ -1643,7 +1643,7 @@ function update_language_list($flags = Language::STATE_CONFIGURABLE) {
if (language_multilingual() || \Drupal::moduleHandler()->moduleExists('language')) {
// Use language module configuration if available. We can not use
// entity_load_multiple() because this breaks during updates.
$language_entities = config_get_storage_names_with_prefix('language.entity');
$language_entities = config_get_storage_names_with_prefix('language.entity.');
// Initialize default property so callers have an easy reference and can
// save the same object without data loss.
......
......@@ -102,7 +102,7 @@ function entity_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) {
// Rename entity displays.
$entity_info = entity_get_info('entity_display');
if ($bundle_old !== $bundle_new) {
$ids = config_get_storage_names_with_prefix('entity.display.' . $entity_type . '.' . $bundle_old);
$ids = config_get_storage_names_with_prefix('entity.display.' . $entity_type . '.' . $bundle_old . '.');
foreach ($ids as $id) {
$id = ConfigStorageController::getIDFromConfigName($id, $entity_info['config_prefix']);
$display = entity_load('entity_display', $id);
......@@ -116,7 +116,7 @@ function entity_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) {
// Rename entity form displays.
$entity_info = entity_get_info('entity_form_display');
if ($bundle_old !== $bundle_new) {
$ids = config_get_storage_names_with_prefix('entity.form_display.' . $entity_type . '.' . $bundle_old);
$ids = config_get_storage_names_with_prefix('entity.form_display.' . $entity_type . '.' . $bundle_old . '.');
foreach ($ids as $id) {
$id = ConfigStorageController::getIDFromConfigName($id, $entity_info['config_prefix']);
$form_display = entity_load('entity_form_display', $id);
......@@ -134,7 +134,7 @@ function entity_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) {
function entity_entity_bundle_delete($entity_type, $bundle) {
// Remove entity displays of the deleted bundle.
$entity_info = entity_get_info('entity_display');
$ids = config_get_storage_names_with_prefix('entity.display.' . $entity_type . '.' . $bundle);
$ids = config_get_storage_names_with_prefix('entity.display.' . $entity_type . '.' . $bundle . '.');
foreach ($ids as &$id) {
$id = ConfigStorageController::getIDFromConfigName($id, $entity_info['config_prefix']);
}
......@@ -142,7 +142,7 @@ function entity_entity_bundle_delete($entity_type, $bundle) {
// Remove entity form displays of the deleted bundle.
$entity_info = entity_get_info('entity_form_display');
$ids = config_get_storage_names_with_prefix('entity.form_display.' . $entity_type . '.' . $bundle);
$ids = config_get_storage_names_with_prefix('entity.form_display.' . $entity_type . '.' . $bundle . '.');
foreach ($ids as &$id) {
$id = ConfigStorageController::getIDFromConfigName($id, $entity_info['config_prefix']);
}
......
......@@ -462,7 +462,7 @@ function field_update_8005() {
'mode' => 'register',
'content' => array(),
);
foreach (config_get_storage_names_with_prefix('field.instance') as $config_id) {
foreach (config_get_storage_names_with_prefix('field.instance.') as $config_id) {
$instance_config = \Drupal::config($config_id);
if ($instance_config->get('entity_type') == 'user' && $instance_config->get('settings.user_register_form')) {
list(, , $field_id) = explode('.', $instance_config->get('id'));
......@@ -485,7 +485,7 @@ function field_update_8005() {
*/
function field_update_8006(&$sandbox) {
// Get field definitions from config, and deleted fields from state system.
$config_names = config_get_storage_names_with_prefix('field.field');
$config_names = config_get_storage_names_with_prefix('field.field.');
$deleted_fields = \Drupal::state()->get('field.field.deleted') ?: array();
// Ditch UUID keys, we will iterate through deleted fields using a numeric
// index.
......
......@@ -742,7 +742,7 @@ protected function getDisplays() {
$display_entity_type = $this->getDisplayType();
$entity_info = $this->entityManager->getDefinition($display_entity_type);
$config_prefix = $entity_info['config_prefix'];
$ids = config_get_storage_names_with_prefix($config_prefix . '.' . $this->entity_type . '.' . $this->bundle);
$ids = config_get_storage_names_with_prefix($config_prefix . '.' . $this->entity_type . '.' . $this->bundle . '.');
foreach ($ids as $id) {
$config_id = str_replace($config_prefix . '.', '', $id);
list(,, $display_mode) = explode('.', $config_id);
......
......@@ -256,7 +256,7 @@ function image_update_8002() {
function image_update_8003() {
$image_factory = \Drupal::service('image.factory');
foreach (array('field', 'instance') as $type) {
$prefix = "field.$type";
$prefix = 'field.' . $type . '.';
foreach (config_get_storage_names_with_prefix($prefix) as $config_id) {
$config = \Drupal::config($config_id);
$is_image = ($type == 'field' && $config->get('type') == 'image') || ($type == 'instance' && $config->get('field_type') == 'image');
......
......@@ -44,7 +44,7 @@ function testMappingCreation() {
// Save bundle mapping config.
rdf_get_mapping($this->entity_type, $this->bundle)->save();
// Test that config file was saved.
$mapping_config = config_get_storage_names_with_prefix('rdf.mapping');
$mapping_config = config_get_storage_names_with_prefix('rdf.mapping.');
$this->assertTrue(in_array($mapping_config_name, $mapping_config), 'Rdf mapping config saved.');
}
......
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