Commit 523964ba authored by webchick's avatar webchick

Issue #2192693 by alexpott, swentel: Remove config.inc.

parent 408b0ad3
...@@ -1714,9 +1714,6 @@ function _drupal_bootstrap_configuration() { ...@@ -1714,9 +1714,6 @@ function _drupal_bootstrap_configuration() {
// Detect string handling method. // Detect string handling method.
Unicode::check(); Unicode::check();
// Load the procedural configuration system helper functions.
require_once __DIR__ . '/config.inc';
// Set the Drupal custom error handler. (requires \Drupal::config()) // Set the Drupal custom error handler. (requires \Drupal::config())
set_error_handler('_drupal_error_handler'); set_error_handler('_drupal_error_handler');
set_exception_handler('_drupal_exception_handler'); set_exception_handler('_drupal_exception_handler');
......
<?php
/**
* @file
* This is the API for configuration storage.
*/
/**
* Gets configuration object names starting with a given prefix.
*
* @deprecated Deprecated since Drupal 8.x-dev, to be removed in Drupal 8.0.
* Use \Drupal::configFactory()->listAll() instead.
*/
function config_get_storage_names_with_prefix($prefix = '') {
return \Drupal::configFactory()->listAll($prefix);
}
/**
* Retrieves a configuration object.
*
* This is the main entry point to the configuration API. Calling
* @code \Drupal::config('book.admin') @endcode will return a configuration
* object in which the book module can store its administrative settings.
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
* Use \Drupal::config().
*
* @param string $name
* The name of the configuration object to retrieve. The name corresponds to
* a configuration file. For @code \Drupal::config('book.admin') @endcode,
* the config object returned will contain the contents of book.admin
* configuration file.
*
* @return \Drupal\Core\Config\Config
* A configuration object.
*/
function config($name) {
return \Drupal::config($name);
}
/**
* Returns the typed config manager service.
*
* Use the typed data manager service for creating typed configuration objects.
*
* @deprecated Deprecated since Drupal 8.x-dev, to be removed in Drupal 8.0.
* Use \Drupal::service('config.typed') instead.
*
* @see \Drupal\Core\TypedData\TypedDataManager::create()
*
* @return \Drupal\Core\Config\TypedConfigManager
*/
function config_typed() {
return \Drupal::service('config.typed');
}
...@@ -825,7 +825,7 @@ function update_language_list($flags = Language::STATE_CONFIGURABLE) { ...@@ -825,7 +825,7 @@ function update_language_list($flags = Language::STATE_CONFIGURABLE) {
if (\Drupal::languageManager()->isMultilingual() || \Drupal::moduleHandler()->moduleExists('language')) { if (\Drupal::languageManager()->isMultilingual() || \Drupal::moduleHandler()->moduleExists('language')) {
// Use language module configuration if available. We can not use // Use language module configuration if available. We can not use
// entity_load_multiple() because this breaks during updates. // entity_load_multiple() because this breaks during updates.
$language_entities = config_get_storage_names_with_prefix('language.entity.'); $language_entities = \Drupal::configFactory()->listAll('language.entity.');
// Initialize default property so callers have an easy reference and can // Initialize default property so callers have an easy reference and can
// save the same object without data loss. // save the same object without data loss.
......
...@@ -25,7 +25,7 @@ abstract class Element extends TypedData { ...@@ -25,7 +25,7 @@ abstract class Element extends TypedData {
* Create typed config object. * Create typed config object.
*/ */
protected function parseElement($key, $data, $definition) { protected function parseElement($key, $data, $definition) {
return config_typed()->create($definition, $data, $key, $this); return \Drupal::service('config.typed')->create($definition, $data, $key, $this);
} }
} }
...@@ -112,7 +112,7 @@ function custom_block_entity_type_alter(array &$entity_types) { ...@@ -112,7 +112,7 @@ function custom_block_entity_type_alter(array &$entity_types) {
*/ */
function custom_block_entity_bundle_info() { function custom_block_entity_bundle_info() {
$bundles = array(); $bundles = array();
foreach (config_get_storage_names_with_prefix('custom_block.type.') as $config_name) { foreach (\Drupal::configFactory()->listAll('custom_block.type.') as $config_name) {
$config = \Drupal::config($config_name); $config = \Drupal::config($config_name);
$bundles['custom_block'][$config->get('id')]['label'] = $config->get('label'); $bundles['custom_block'][$config->get('id')]['label'] = $config->get('label');
} }
......
...@@ -79,7 +79,7 @@ function breakpoint_modules_uninstalled($modules) { ...@@ -79,7 +79,7 @@ function breakpoint_modules_uninstalled($modules) {
* Either Breakpoint::SOURCE_TYPE_THEME or Breakpoint::SOURCE_TYPE_MODULE. * Either Breakpoint::SOURCE_TYPE_THEME or Breakpoint::SOURCE_TYPE_MODULE.
*/ */
function _breakpoint_delete_breakpoints($list, $source_type) { function _breakpoint_delete_breakpoints($list, $source_type) {
$ids = config_get_storage_names_with_prefix('breakpoint.breakpoint_group.' . $source_type . '.'); $ids = \Drupal::configFactory()->listAll('breakpoint.breakpoint_group.' . $source_type . '.');
$entity_manager = \Drupal::entityManager(); $entity_manager = \Drupal::entityManager();
$entity_type = $entity_manager->getDefinition('breakpoint_group'); $entity_type = $entity_manager->getDefinition('breakpoint_group');
......
...@@ -41,21 +41,21 @@ public function setUp() { ...@@ -41,21 +41,21 @@ public function setUp() {
*/ */
function testSchemaMapping() { function testSchemaMapping() {
// Nonexistent configuration key will have Unknown as metadata. // Nonexistent configuration key will have Unknown as metadata.
$this->assertIdentical(FALSE, config_typed()->hasConfigSchema('config_test.no_such_key')); $this->assertIdentical(FALSE, \Drupal::service('config.typed')->hasConfigSchema('config_test.no_such_key'));
$definition = config_typed()->getDefinition('config_test.no_such_key'); $definition = \Drupal::service('config.typed')->getDefinition('config_test.no_such_key');
$expected = array(); $expected = array();
$expected['label'] = 'Unknown'; $expected['label'] = 'Unknown';
$expected['class'] = '\Drupal\Core\Config\Schema\Property'; $expected['class'] = '\Drupal\Core\Config\Schema\Property';
$this->assertEqual($definition, $expected, 'Retrieved the right metadata for nonexistent configuration.'); $this->assertEqual($definition, $expected, 'Retrieved the right metadata for nonexistent configuration.');
// Configuration file without schema will return Unknown as well. // Configuration file without schema will return Unknown as well.
$this->assertIdentical(FALSE, config_typed()->hasConfigSchema('config_test.noschema')); $this->assertIdentical(FALSE, \Drupal::service('config.typed')->hasConfigSchema('config_test.noschema'));
$definition = config_typed()->getDefinition('config_test.noschema'); $definition = \Drupal::service('config.typed')->getDefinition('config_test.noschema');
$this->assertEqual($definition, $expected, 'Retrieved the right metadata for configuration with no schema.'); $this->assertEqual($definition, $expected, 'Retrieved the right metadata for configuration with no schema.');
// Configuration file with only some schema. // Configuration file with only some schema.
$this->assertIdentical(TRUE, config_typed()->hasConfigSchema('config_test.someschema')); $this->assertIdentical(TRUE, \Drupal::service('config.typed')->hasConfigSchema('config_test.someschema'));
$definition = config_typed()->getDefinition('config_test.someschema'); $definition = \Drupal::service('config.typed')->getDefinition('config_test.someschema');
$expected = array(); $expected = array();
$expected['label'] = 'Schema test data'; $expected['label'] = 'Schema test data';
$expected['class'] = '\Drupal\Core\Config\Schema\Mapping'; $expected['class'] = '\Drupal\Core\Config\Schema\Mapping';
...@@ -64,7 +64,7 @@ function testSchemaMapping() { ...@@ -64,7 +64,7 @@ function testSchemaMapping() {
$this->assertEqual($definition, $expected, 'Retrieved the right metadata for configuration with only some schema.'); $this->assertEqual($definition, $expected, 'Retrieved the right metadata for configuration with only some schema.');
// Check type detection on elements with undefined types. // Check type detection on elements with undefined types.
$config = config_typed()->get('config_test.someschema'); $config = \Drupal::service('config.typed')->get('config_test.someschema');
$definition = $config['testitem']->getDataDefinition(); $definition = $config['testitem']->getDataDefinition();
$expected = array(); $expected = array();
$expected['label'] = 'Test item'; $expected['label'] = 'Test item';
...@@ -79,7 +79,7 @@ function testSchemaMapping() { ...@@ -79,7 +79,7 @@ function testSchemaMapping() {
$this->assertEqual($definition, $expected, 'Automatic type fallback on non-string item worked.'); $this->assertEqual($definition, $expected, 'Automatic type fallback on non-string item worked.');
// Simple case, straight metadata. // Simple case, straight metadata.
$definition = config_typed()->getDefinition('system.maintenance'); $definition = \Drupal::service('config.typed')->getDefinition('system.maintenance');
$expected = array(); $expected = array();
$expected['label'] = 'Maintenance mode'; $expected['label'] = 'Maintenance mode';
$expected['class'] = '\Drupal\Core\Config\Schema\Mapping'; $expected['class'] = '\Drupal\Core\Config\Schema\Mapping';
...@@ -94,7 +94,7 @@ function testSchemaMapping() { ...@@ -94,7 +94,7 @@ function testSchemaMapping() {
$this->assertEqual($definition, $expected, 'Retrieved the right metadata for system.maintenance'); $this->assertEqual($definition, $expected, 'Retrieved the right metadata for system.maintenance');
// More complex case, generic type. Metadata for image style. // More complex case, generic type. Metadata for image style.
$definition = config_typed()->getDefinition('image.style.large'); $definition = \Drupal::service('config.typed')->getDefinition('image.style.large');
$expected = array(); $expected = array();
$expected['label'] = 'Image style'; $expected['label'] = 'Image style';
$expected['class'] = '\Drupal\Core\Config\Schema\Mapping'; $expected['class'] = '\Drupal\Core\Config\Schema\Mapping';
...@@ -116,7 +116,7 @@ function testSchemaMapping() { ...@@ -116,7 +116,7 @@ function testSchemaMapping() {
$this->assertEqual($definition, $expected, 'Retrieved the right metadata for image.style.large'); $this->assertEqual($definition, $expected, 'Retrieved the right metadata for image.style.large');
// More complex, type based on a complex one. // More complex, type based on a complex one.
$definition = config_typed()->getDefinition('image.effect.image_scale'); $definition = \Drupal::service('config.typed')->getDefinition('image.effect.image_scale');
// This should be the schema for image.effect.image_scale. // This should be the schema for image.effect.image_scale.
$expected = array(); $expected = array();
$expected['label'] = 'Image scale'; $expected['label'] = 'Image scale';
...@@ -131,7 +131,7 @@ function testSchemaMapping() { ...@@ -131,7 +131,7 @@ function testSchemaMapping() {
$this->assertEqual($definition, $expected, 'Retrieved the right metadata for image.effect.image_scale'); $this->assertEqual($definition, $expected, 'Retrieved the right metadata for image.effect.image_scale');
// Most complex case, get metadata for actual configuration element. // Most complex case, get metadata for actual configuration element.
$effects = config_typed()->get('image.style.medium')->get('effects'); $effects = \Drupal::service('config.typed')->get('image.style.medium')->get('effects');
$definition = $effects['bddf0d06-42f9-4c75-a700-a33cafa25ea0']['data']->getDataDefinition(); $definition = $effects['bddf0d06-42f9-4c75-a700-a33cafa25ea0']['data']->getDataDefinition();
// This should be the schema for image.effect.image_scale, reuse previous one. // This should be the schema for image.effect.image_scale, reuse previous one.
$expected['type'] = 'image.effect.image_scale'; $expected['type'] = 'image.effect.image_scale';
...@@ -139,7 +139,7 @@ function testSchemaMapping() { ...@@ -139,7 +139,7 @@ function testSchemaMapping() {
$this->assertEqual($definition, $expected, 'Retrieved the right metadata for the first effect of image.style.medium'); $this->assertEqual($definition, $expected, 'Retrieved the right metadata for the first effect of image.style.medium');
// More complex, multiple filesystem marker test. // More complex, multiple filesystem marker test.
$definition = config_typed()->getDefinition('config_test.someschema.somemodule.section_one.subsection'); $definition = \Drupal::service('config.typed')->getDefinition('config_test.someschema.somemodule.section_one.subsection');
// This should be the schema of config_test.someschema.somemodule.*.*. // This should be the schema of config_test.someschema.somemodule.*.*.
$expected = array(); $expected = array();
$expected['label'] = 'Schema multiple filesytem marker test'; $expected['label'] = 'Schema multiple filesytem marker test';
...@@ -151,7 +151,7 @@ function testSchemaMapping() { ...@@ -151,7 +151,7 @@ function testSchemaMapping() {
$this->assertEqual($definition, $expected, 'Retrieved the right metadata for config_test.someschema.somemodule.section_one.subsection'); $this->assertEqual($definition, $expected, 'Retrieved the right metadata for config_test.someschema.somemodule.section_one.subsection');
$definition = config_typed()->getDefinition('config_test.someschema.somemodule.section_two.subsection'); $definition = \Drupal::service('config.typed')->getDefinition('config_test.someschema.somemodule.section_two.subsection');
// The other file should have the same schema. // The other file should have the same schema.
$this->assertEqual($definition, $expected, 'Retrieved the right metadata for config_test.someschema.somemodule.section_two.subsection'); $this->assertEqual($definition, $expected, 'Retrieved the right metadata for config_test.someschema.somemodule.section_two.subsection');
} }
...@@ -160,7 +160,7 @@ function testSchemaMapping() { ...@@ -160,7 +160,7 @@ function testSchemaMapping() {
* Tests metadata retrieval with several levels of %parent indirection. * Tests metadata retrieval with several levels of %parent indirection.
*/ */
function testSchemaMappingWithParents() { function testSchemaMappingWithParents() {
$config_data = config_typed()->get('config_test.someschema.with_parents'); $config_data = \Drupal::service('config.typed')->get('config_test.someschema.with_parents');
// Test fetching parent one level up. // Test fetching parent one level up.
$entry = $config_data->get('one_level'); $entry = $config_data->get('one_level');
...@@ -198,7 +198,7 @@ function testSchemaMappingWithParents() { ...@@ -198,7 +198,7 @@ function testSchemaMappingWithParents() {
*/ */
function testSchemaData() { function testSchemaData() {
// Try some simple properties. // Try some simple properties.
$meta = config_typed()->get('system.site'); $meta = \Drupal::service('config.typed')->get('system.site');
$property = $meta->get('name'); $property = $meta->get('name');
$this->assertTrue($property instanceof StringInterface, 'Got the right wrapper fo the site name property.'); $this->assertTrue($property instanceof StringInterface, 'Got the right wrapper fo the site name property.');
$this->assertEqual($property->getValue(), 'Drupal', 'Got the right string value for site name data.'); $this->assertEqual($property->getValue(), 'Drupal', 'Got the right string value for site name data.');
...@@ -224,7 +224,7 @@ function testSchemaData() { ...@@ -224,7 +224,7 @@ function testSchemaData() {
$this->assertTrue(count($values) == 3 && $values['front'] == 'user', 'Got the right property values for site page.'); $this->assertTrue(count($values) == 3 && $values['front'] == 'user', 'Got the right property values for site page.');
// Now let's try something more complex, with nested objects. // Now let's try something more complex, with nested objects.
$wrapper = config_typed()->get('image.style.large'); $wrapper = \Drupal::service('config.typed')->get('image.style.large');
$effects = $wrapper->get('effects'); $effects = $wrapper->get('effects');
// The function is_array() doesn't work with ArrayAccess, so we use count(). // The function is_array() doesn't work with ArrayAccess, so we use count().
...@@ -237,7 +237,7 @@ function testSchemaData() { ...@@ -237,7 +237,7 @@ function testSchemaData() {
// Finally update some object using a configuration wrapper. // Finally update some object using a configuration wrapper.
$new_slogan = 'Site slogan for testing configuration metadata'; $new_slogan = 'Site slogan for testing configuration metadata';
$wrapper = config_typed()->get('system.site'); $wrapper = \Drupal::service('config.typed')->get('system.site');
$wrapper->set('slogan', $new_slogan); $wrapper->set('slogan', $new_slogan);
$site_slogan = $wrapper->get('slogan'); $site_slogan = $wrapper->get('slogan');
$this->assertEqual($site_slogan->getValue(), $new_slogan, 'Successfully updated the contained configuration data'); $this->assertEqual($site_slogan->getValue(), $new_slogan, 'Successfully updated the contained configuration data');
......
...@@ -84,7 +84,7 @@ function contact_entity_type_alter(array &$entity_types) { ...@@ -84,7 +84,7 @@ function contact_entity_type_alter(array &$entity_types) {
*/ */
function contact_entity_bundle_info() { function contact_entity_bundle_info() {
$bundles = array(); $bundles = array();
foreach (config_get_storage_names_with_prefix('contact.category.') as $config_name) { foreach (\Drupal::configFactory()->listAll('contact.category.') as $config_name) {
$config = \Drupal::config($config_name); $config = \Drupal::config($config_name);
$bundles['contact_message'][$config->get('id')]['label'] = $config->get('label'); $bundles['contact_message'][$config->get('id')]['label'] = $config->get('label');
} }
......
...@@ -146,7 +146,7 @@ function content_translation_entity_bundle_info_alter(&$bundles) { ...@@ -146,7 +146,7 @@ function content_translation_entity_bundle_info_alter(&$bundles) {
* Implements hook_entity_field_info_alter(). * Implements hook_entity_field_info_alter().
*/ */
function content_translation_entity_field_info_alter(&$info, $entity_type) { function content_translation_entity_field_info_alter(&$info, $entity_type) {
$translation_settings = config('content_translation.settings')->get($entity_type); $translation_settings = \Drupal::config('content_translation.settings')->get($entity_type);
if ($translation_settings) { if ($translation_settings) {
// Currently field translatability is defined per-field but we may want to // Currently field translatability is defined per-field but we may want to
......
...@@ -81,7 +81,7 @@ function entity_entity_bundle_rename($entity_type_id, $bundle_old, $bundle_new) ...@@ -81,7 +81,7 @@ function entity_entity_bundle_rename($entity_type_id, $bundle_old, $bundle_new)
// Rename entity displays. // Rename entity displays.
$entity_type = \Drupal::entityManager()->getDefinition('entity_view_display'); $entity_type = \Drupal::entityManager()->getDefinition('entity_view_display');
if ($bundle_old !== $bundle_new) { if ($bundle_old !== $bundle_new) {
$ids = config_get_storage_names_with_prefix('entity.view_display.' . $entity_type_id . '.' . $bundle_old . '.'); $ids = \Drupal::configFactory()->listAll('entity.view_display.' . $entity_type_id . '.' . $bundle_old . '.');
foreach ($ids as $id) { foreach ($ids as $id) {
$id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix()); $id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix());
$display = entity_load('entity_view_display', $id); $display = entity_load('entity_view_display', $id);
...@@ -95,7 +95,7 @@ function entity_entity_bundle_rename($entity_type_id, $bundle_old, $bundle_new) ...@@ -95,7 +95,7 @@ function entity_entity_bundle_rename($entity_type_id, $bundle_old, $bundle_new)
// Rename entity form displays. // Rename entity form displays.
$entity_type = \Drupal::entityManager()->getDefinition('entity_form_display'); $entity_type = \Drupal::entityManager()->getDefinition('entity_form_display');
if ($bundle_old !== $bundle_new) { if ($bundle_old !== $bundle_new) {
$ids = config_get_storage_names_with_prefix('entity.form_display.' . $entity_type_id . '.' . $bundle_old . '.'); $ids = \Drupal::configFactory()->listAll('entity.form_display.' . $entity_type_id . '.' . $bundle_old . '.');
foreach ($ids as $id) { foreach ($ids as $id) {
$id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix()); $id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix());
$form_display = entity_load('entity_form_display', $id); $form_display = entity_load('entity_form_display', $id);
...@@ -113,7 +113,7 @@ function entity_entity_bundle_rename($entity_type_id, $bundle_old, $bundle_new) ...@@ -113,7 +113,7 @@ function entity_entity_bundle_rename($entity_type_id, $bundle_old, $bundle_new)
function entity_entity_bundle_delete($entity_type_id, $bundle) { function entity_entity_bundle_delete($entity_type_id, $bundle) {
// Remove entity displays of the deleted bundle. // Remove entity displays of the deleted bundle.
$entity_type = \Drupal::entityManager()->getDefinition('entity_view_display'); $entity_type = \Drupal::entityManager()->getDefinition('entity_view_display');
$ids = config_get_storage_names_with_prefix('entity.view_display.' . $entity_type_id . '.' . $bundle . '.'); $ids = \Drupal::configFactory()->listAll('entity.view_display.' . $entity_type_id . '.' . $bundle . '.');
foreach ($ids as &$id) { foreach ($ids as &$id) {
$id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix()); $id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix());
} }
...@@ -121,7 +121,7 @@ function entity_entity_bundle_delete($entity_type_id, $bundle) { ...@@ -121,7 +121,7 @@ function entity_entity_bundle_delete($entity_type_id, $bundle) {
// Remove entity form displays of the deleted bundle. // Remove entity form displays of the deleted bundle.
$entity_type = \Drupal::entityManager()->getDefinition('entity_form_display'); $entity_type = \Drupal::entityManager()->getDefinition('entity_form_display');
$ids = config_get_storage_names_with_prefix('entity.form_display.' . $entity_type_id . '.' . $bundle . '.'); $ids = \Drupal::configFactory()->listAll('entity.form_display.' . $entity_type_id . '.' . $bundle . '.');
foreach ($ids as &$id) { foreach ($ids as &$id) {
$id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix()); $id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix());
} }
......
...@@ -59,7 +59,7 @@ class FieldInfo { ...@@ -59,7 +59,7 @@ class FieldInfo {
* *
* @var \Drupal\Core\Config\ConfigFactoryInterface * @var \Drupal\Core\Config\ConfigFactoryInterface
*/ */
protected $config; protected $configFactory;
/** /**
* The language manager. * The language manager.
...@@ -136,7 +136,7 @@ class FieldInfo { ...@@ -136,7 +136,7 @@ class FieldInfo {
* *
* @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
* The cache backend to use. * The cache backend to use.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The configuration factory object to use. * The configuration factory object to use.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler class to use for invoking hooks. * The module handler class to use for invoking hooks.
...@@ -145,10 +145,10 @@ class FieldInfo { ...@@ -145,10 +145,10 @@ class FieldInfo {
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager to use. * The language manager to use.
*/ */
public function __construct(CacheBackendInterface $cache_backend, ConfigFactoryInterface $config, ModuleHandlerInterface $module_handler, FieldTypePluginManagerInterface $field_type_manager, LanguageManagerInterface $language_manager) { public function __construct(CacheBackendInterface $cache_backend, ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, FieldTypePluginManagerInterface $field_type_manager, LanguageManagerInterface $language_manager) {
$this->cacheBackend = $cache_backend; $this->cacheBackend = $cache_backend;
$this->moduleHandler = $module_handler; $this->moduleHandler = $module_handler;
$this->config = $config; $this->configFactory = $config_factory;
$this->fieldTypeManager = $field_type_manager; $this->fieldTypeManager = $field_type_manager;
$this->languageManager = $language_manager; $this->languageManager = $language_manager;
} }
...@@ -201,13 +201,13 @@ public function getFieldMap() { ...@@ -201,13 +201,13 @@ public function getFieldMap() {
$map = array(); $map = array();
// Get fields. // Get fields.
foreach (config_get_storage_names_with_prefix('field.field.') as $config_id) { foreach ($this->configFactory->listAll('field.field.') as $config_id) {
$field_config = $this->config->get($config_id)->get(); $field_config = $this->configFactory->get($config_id)->get();
$fields[$field_config['uuid']] = $field_config; $fields[$field_config['uuid']] = $field_config;
} }
// Get field instances. // Get field instances.
foreach (config_get_storage_names_with_prefix('field.instance.') as $config_id) { foreach ($this->configFactory->listAll('field.instance.') as $config_id) {
$instance_config = $this->config->get($config_id)->get(); $instance_config = $this->configFactory->get($config_id)->get();
$field_uuid = $instance_config['field_uuid']; $field_uuid = $instance_config['field_uuid'];
if (isset($fields[$field_uuid])) { if (isset($fields[$field_uuid])) {
$field = $fields[$field_uuid]; $field = $fields[$field_uuid];
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\field_ui; namespace Drupal\field_ui;
use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\PluginManagerBase;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Entity\Display\EntityDisplayInterface; use Drupal\Core\Entity\Display\EntityDisplayInterface;
use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityManagerInterface;
...@@ -43,9 +44,11 @@ class DisplayOverview extends DisplayOverviewBase { ...@@ -43,9 +44,11 @@ class DisplayOverview extends DisplayOverviewBase {
* The widget or formatter plugin manager. * The widget or formatter plugin manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler class to use for invoking hooks. * The module handler class to use for invoking hooks.
* @param \Drupal\Core\Config\ConfigFactory $config_factory
* The configuration factory.
*/ */
public function __construct(EntityManagerInterface $entity_manager, FieldTypePluginManager $field_type_manager, PluginManagerBase $plugin_manager, ModuleHandlerInterface $module_handler) { public function __construct(EntityManagerInterface $entity_manager, FieldTypePluginManager $field_type_manager, PluginManagerBase $plugin_manager, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory) {
parent::__construct($entity_manager, $field_type_manager, $plugin_manager); parent::__construct($entity_manager, $field_type_manager, $plugin_manager, $config_factory);
$this->moduleHandler = $module_handler; $this->moduleHandler = $module_handler;
} }
...@@ -57,8 +60,9 @@ public static function create(ContainerInterface $container) { ...@@ -57,8 +60,9 @@ public static function create(ContainerInterface $container) {
$container->get('entity.manager'), $container->get('entity.manager'),
$container->get('plugin.manager.field.field_type'), $container->get('plugin.manager.field.field_type'),
$container->get('plugin.manager.field.formatter'), $container->get('plugin.manager.field.formatter'),
$container->get('module_handler') $container->get('module_handler'),
); $container->get('config.factory')
);
} }
/** /**
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\field_ui; namespace Drupal\field_ui;
use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\PluginManagerBase;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\Display\EntityDisplayInterface; use Drupal\Core\Entity\Display\EntityDisplayInterface;
use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldDefinitionInterface;
...@@ -40,6 +41,13 @@ abstract class DisplayOverviewBase extends OverviewBase { ...@@ -40,6 +41,13 @@ abstract class DisplayOverviewBase extends OverviewBase {
*/ */
protected $fieldTypes; protected $fieldTypes;
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/** /**
* Constructs a new DisplayOverviewBase. * Constructs a new DisplayOverviewBase.
* *
...@@ -49,12 +57,15 @@ abstract class DisplayOverviewBase extends OverviewBase { ...@@ -49,12 +57,15 @@ abstract class DisplayOverviewBase extends OverviewBase {
* The field type manager. * The field type manager.
* @param \Drupal\Component\Plugin\PluginManagerBase $plugin_manager * @param \Drupal\Component\Plugin\PluginManagerBase $plugin_manager
* The widget or formatter plugin manager. * The widget or formatter plugin manager.
* @param \Drupal\Core\Config\ConfigFactory $config_factory
* The configuration factory.
*/ */
public function __construct(EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, PluginManagerBase $plugin_manager) { public function __construct(EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, PluginManagerBase $plugin_manager, ConfigFactoryInterface $config_factory) {
parent::__construct($entity_manager); parent::__construct($entity_manager);
$this->fieldTypes = $field_type_manager->getConfigurableDefinitions(); $this->fieldTypes = $field_type_manager->getConfigurableDefinitions();
$this->pluginManager = $plugin_manager; $this->pluginManager = $plugin_manager;
$this->configFactory = $config_factory;
} }
/** /**
...@@ -64,7 +75,8 @@ public static function create(ContainerInterface $container) { ...@@ -64,7 +75,8 @@ public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('entity.manager'), $container->get('entity.manager'),
$container->get('plugin.manager.field.field_type'), $container->get('plugin.manager.field.field_type'),
$container->get('plugin.manager.field.widget') $container->get('plugin.manager.field.widget'),
$container->get('config.factory')
); );
} }
...@@ -772,7 +784,7 @@ protected function getDisplays() { ...@@ -772,7 +784,7 @@ protected function getDisplays() {
$display_entity_type = $this->getDisplayType(); $display_entity_type = $this->getDisplayType();
$entity_type = $this->entityManager->getDefinition($display_entity_type); $entity_type = $this->entityManager->getDefinition($display_entity_type);
$config_prefix = $entity_type->getConfigPrefix(); $config_prefix = $entity_type->getConfigPrefix();
$ids = config_get_storage_names_with_prefix($config_prefix . '.' . $this->entity_type . '.' . $this->bundle . '.'); $ids = $this->configFactory->listAll($config_prefix . '.' . $this->entity_type . '.' . $this->bundle . '.');
foreach ($ids as $id) { foreach ($ids as $id) {
$config_id = str_replace($config_prefix . '.', '', $id); $config_id = str_replace($config_prefix . '.', '', $id);
list(,, $display_mode) = explode('.', $config_id); list(,, $display_mode) = explode('.', $config_id);
......