/** * Causes the container to be rebuilt on the next request. * * This event subscriber assumes that the new default langcode and old default * langcode are valid langcodes. If the schema definition of either * system.site:default_langcode or language.negotiation::url.prefixes changes * then this event must be changed to work with both the old and new schema * definition so this event is update safe. * * @param ConfigCrudEvent $event * The configuration event. */ public function onConfigSave(ConfigCrudEvent $event) { $saved_config = $event->getConfig(); if ($saved_config->getName() == 'system.site' && $event->isChanged('default_langcode')) { $new_default_langcode = $saved_config->get('default_langcode'); $default_language = $this->configFactory->get('language.entity.' . $new_default_langcode); // During an import the language might not exist yet. if (!$default_language->isNew()) { $this->languageDefault->set(new Language($default_language->get())); $this->languageManager->reset(); // Directly update language negotiation settings instead of calling // language_negotiation_url_prefixes_update() to ensure that the code // obeys the hook_update_N() restrictions. $negotiation_config = $this->configFactory->getEditable('language.negotiation'); $negotiation_changed = FALSE; $url_prefixes = $negotiation_config->get('url.prefixes'); $old_default_langcode = $saved_config->getOriginal('default_langcode'); if (empty($url_prefixes[$old_default_langcode])) { $negotiation_config->set('url.prefixes.' . $old_default_langcode, $old_default_langcode); $negotiation_changed = TRUE; } if (empty($url_prefixes[$new_default_langcode])) { $negotiation_config->set('url.prefixes.' . $new_default_langcode, ''); $negotiation_changed = TRUE; } if ($negotiation_changed) { $negotiation_config->save(TRUE); } } // Trigger a container rebuild on the next request by invalidating it. ConfigurableLanguageManager::rebuildServices(); } }
/** * Gets the configuration object when needed. * * Since this service is injected into all static menu link objects, but * only used when updating one, avoid actually loading the config when it's * not needed. */ protected function getConfig() { if (empty($this->config)) { // Get an override free and editable configuration object. $this->config = $this->configFactory->getEditable($this->configName); } return $this->config; }
/** * {@inheritdoc} */ public function markAsDefault(StoreInterface $store) { $config = $this->configFactory->getEditable('commerce_store.settings'); if ($config->get('default_store') != $store->uuid()) { $config->set('default_store', $store->uuid()); $config->save(); } }
/** * @param \Drupal\migrate\Event\MigrateImportEvent $event */ public function onMigratePostImport(MigrateImportEvent $event) { if ('basic_block' === $event->getMigration()->get('id')) { $files = ['block.block.callforpaper.yml', 'block.block.featuredfirst.yml', 'block.block.featuredsecond.yml', 'block.block.featuredthird.yml', 'block.block.mentorship.yml', 'block.block.training.yml']; foreach ($files as $file) { $base_path = $this->moduleHandler->getModule('ddd_fixtures')->getPath(); $contents = @file_get_contents($base_path . '/sources/block_configs/' . $file); $config_name = basename('sources/block_configs/' . $file, '.yml'); $data = (new InstallStorage())->decode($contents); $this->configFactory->getEditable($config_name)->setData($data)->save(); } } }
/** * Saves the configuration. * * @param bool[] $configuration * Keys are currency_exchanger plugin names. Values are booleans that * describe whether the plugins are enabled. Items are ordered by weight. * * @return $this */ public function saveConfiguration(array $configuration) { $config = $this->configFactory->getEditable('currency.exchange_rate_provider'); // Massage the configuration into a format that can be stored, as // associative arrays are not supported by the config system $configuration_data = array(); foreach ($configuration as $plugin_id => $status) { $configuration_data[] = array('plugin_id' => $plugin_id, 'status' => $status); } $config->set('plugins', $configuration_data); $config->save(); return $this; }
/** * {@inheritdoc} */ public function revert($type, $name) { // Read the config from the file. $full_name = $this->getFullName($type, $name); $value = $this->extensionConfigStorage->read($full_name); if (!$value) { $value = $this->extensionOptionalConfigStorage->read($full_name); } if (!$value) { return FALSE; } if ($type == 'system.simple') { // Load the current config and replace the value. $this->configFactory->getEditable($full_name)->setData($value)->save(); } else { // Load the current config entity and replace the value, with the // old UUID. $definition = $this->entityManager->getDefinition($type); $id_key = $definition->getKey('id'); $id = $value[$id_key]; $entity_storage = $this->entityManager->getStorage($type); $entity = $entity_storage->load($id); $uuid = $entity->get('uuid'); $entity = $entity_storage->updateFromStorageRecord($entity, $value); $entity->set('uuid', $uuid); $entity->save(); } // Trigger an event notifying of this change. $event = new ConfigRevertEvent($type, $name); $this->dispatcher->dispatch(ConfigRevertInterface::REVERT, $event); return TRUE; }
/** * {@inheritdoc} */ public function uninstall($type, $name) { $entities = $this->getConfigEntitiesToChangeOnDependencyRemoval($type, [$name], FALSE); // Fix all dependent configuration entities. /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */ foreach ($entities['update'] as $entity) { $entity->save(); } // Remove all dependent configuration entities. foreach ($entities['delete'] as $entity) { $entity->setUninstalling(TRUE); $entity->delete(); } $config_names = $this->configFactory->listAll($name . '.'); foreach ($config_names as $config_name) { $this->configFactory->getEditable($config_name)->delete(); } // Remove any matching configuration from collections. foreach ($this->activeStorage->getAllCollectionNames() as $collection) { $collection_storage = $this->activeStorage->createCollection($collection); $collection_storage->deleteAll($name . '.'); } $schema_dir = drupal_get_path($type, $name) . '/' . InstallStorage::CONFIG_SCHEMA_DIRECTORY; if (is_dir($schema_dir)) { // Refresh the schema cache if uninstalling an extension that provides // configuration schema. $this->typedConfigManager->clearCachedDefinitions(); } }
/** * {@inheritdoc} */ protected function doSave($id, EntityInterface $entity) { $is_new = $entity->isNew(); $prefix = $this->getPrefix(); $config_name = $prefix . $entity->id(); if ($id !== $entity->id()) { // Renaming a config object needs to cater for: // - Storage needs to access the original object. // - The object needs to be renamed/copied in ConfigFactory and reloaded. // - All instances of the object need to be renamed. $this->configFactory->rename($prefix . $id, $config_name); } $config = $this->configFactory->getEditable($config_name); // Retrieve the desired properties and set them in config. $config->setData($this->mapToStorageRecord($entity)); $config->save($entity->hasTrustedData()); // Update the entity with the values stored in configuration. It is possible // that configuration schema has casted some of the values. if (!$entity->hasTrustedData()) { $data = $this->mapFromStorageRecords(array($config->get())); $updated_entity = current($data); foreach (array_keys($config->get()) as $property) { $value = $updated_entity->get($property); $entity->set($property, $value); } } return $is_new ? SAVED_NEW : SAVED_UPDATED; }
/** * Constructs a XmlSitemapGenerator object. * * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The config factory object. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager handler. * @param \Drupal\Core\State\StateInterface $state * The state handler. */ public function __construct(ConfigFactoryInterface $config_factory, EntityManagerInterface $entity_manager, StateInterface $state, LanguageManagerInterface $language_manager) { $this->config = $config_factory->getEditable('xmlsitemap.settings'); $this->entityManager = $entity_manager; $this->state = $state; $this->languageManager = $language_manager; }
/** * {@inheritdoc} */ public function getConfigData() { $config_data = array(); foreach ($this->getConfigNames() as $name) { $config_data[$name] = $this->configFactory->getEditable($name)->get(); } return $config_data; }
/** * {@inheritdoc} */ public function setDefault($name) { $list = $this->listInfo(); if (!isset($list[$name])) { throw new \InvalidArgumentException("{$name} theme is not installed."); } $this->configFactory->getEditable('system.theme')->set('default', $name)->save(); return $this; }
/** * Constructs a ImageEffectsPluginBase object. * * @param array $configuration * A configuration array containing information about the plugin instance. * @param string $plugin_id * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The configuration factory. * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator * The URL generator. * @param \Psr\Log\LoggerInterface $logger * The image_effects logger. */ public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, UrlGeneratorInterface $url_generator, LoggerInterface $logger) { $this->config = $config_factory->getEditable('image_effects.settings'); parent::__construct($configuration, $plugin_id, $plugin_definition); $this->pluginType = $configuration['plugin_type']; $config = $this->config->get($this->pluginType . '.plugin_settings.' . $plugin_id); $this->setConfiguration(array_merge($this->defaultConfiguration(), is_array($config) ? $config : array())); $this->urlGenerator = $url_generator; $this->logger = $logger; }
/** * {@inheritdoc} */ public function saveLanguageTypesConfiguration(array $values) { $config = $this->configFactory->getEditable('language.types'); if (isset($values['configurable'])) { $config->set('configurable', $values['configurable']); } if (isset($values['all'])) { $config->set('all', $values['all']); } $config->save(); }
/** * Updates the locale strings when a configuration override is saved/deleted. * * @param \Drupal\language\Config\LanguageConfigOverrideCrudEvent $event * The language configuration event. */ public function onOverrideChange(LanguageConfigOverrideCrudEvent $event) { // Only attempt to feed back configuration override changes to locale if // the update itself was not initiated by locale data changes. if (!drupal_installation_attempted() && !$this->localeConfigManager->isUpdatingTranslationsFromLocale()) { $translation_config = $event->getLanguageConfigOverride(); $langcode = $translation_config->getLangcode(); $reference_config = $this->configFactory->getEditable($translation_config->getName())->get(); $this->updateLocaleStorage($translation_config, $langcode, $reference_config); } }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $key = $this->entity_type_parameter . '_' . $this->entity_type_id; $userInputValues = $form_state->getUserInput(); $config = $this->configFactory->getEditable('auto_entitylabel.settings'); $config->set('auto_entitylabel_php_' . $key, $userInputValues['auto_entitylabel_php_' . $key]); $config->set('auto_entitylabel_pattern_' . $key, $userInputValues['auto_entitylabel_pattern_' . $key]); $config->set('auto_entitylabel_' . $key, $userInputValues['auto_entitylabel_' . $key]); $config->save(); parent::submitForm($form, $form_state); }
/** * Updates the translation strings of shipped configuration. * * @param \Drupal\language\Config\LanguageConfigOverrideCrudEvent $event * The language configuration event. * @param $callable * A callable to apply to each translatable string of the configuration. */ protected function updateTranslationStrings(LanguageConfigOverrideCrudEvent $event, $callable) { $translation_config = $event->getLanguageConfigOverride(); $name = $translation_config->getName(); // Only do anything if the configuration was shipped. if ($this->stringStorage->getLocations(['type' => 'configuration', 'name' => $name])) { $source_config = $this->configFactory->getEditable($name); $schema = $this->localeConfigManager->get($name)->getTypedConfig(); $this->traverseSchema($schema, $source_config, $translation_config, $callable); } }
/** * Update entity browser configuration. * * @param string $browser * Id of the entity browser. * @param array $configuration * Configuration array to update. * @param array $oldConfiguration * Only if current config is same like old config we are updating. * * @return bool * Indicates if config was updated or not. */ public function updateEntityBrowserConfig($browser, $configuration, $oldConfiguration = []) { $ebConfig = $this->configFactory->getEditable('entity_browser.browser.' . $browser); $config = $ebConfig->get(); if (!empty($oldConfiguration) && DiffArray::diffAssocRecursive($oldConfiguration, $config)) { return FALSE; } $ebConfig->setData(NestedArray::mergeDeep($config, $configuration)); $ebConfig->save(); // Update entity browser edit form. $entityBrowserConfig = $this->tempStoreFactory->get('entity_browser.config'); $storage = $entityBrowserConfig->get($browser); if (!empty($storage)) { foreach ($configuration as $key => $value) { $part = $storage['entity_browser']->getPluginCollections()[$key]; $part->setConfiguration(NestedArray::mergeDeep($part->getConfiguration(), $value)); } $entityBrowserConfig->set($browser, $storage); } return TRUE; }
/** * Deletes an exchange rate. * * @param string $currency_code_from * @param string $currency_code_to * * @return NULL */ public function delete($currency_code_from, $currency_code_to) { $config = $this->configFactory->getEditable('currency.exchanger.fixed_rates'); $rates = $config->get('rates'); foreach ($rates as $i => $rate) { if ($rate['currency_code_from'] == $currency_code_from && $rate['currency_code_to'] == $currency_code_to) { unset($rates[$i]); } } $config->set('rates', $rates); $config->save(); }
/** * Gets the edited config object. * * @return \Drupal\rules\Ui\RulesUiComponentProviderInterface|\Drupal\Core\Config\Config * The component provider object (usually a config entity) or the editable * config object. */ public function getConfig() { $config = $this->fetchFromTempStore(); if (!$config) { if (isset($this->pluginDefinition->settings['config_parameter'])) { $config = $this->currentRouteMatch->getParameter($this->pluginDefinition->settings['config_parameter']); } else { $config = $this->configFactory->getEditable($this->pluginDefinition->settings['config_name']); } } return $config; }
/** * {@inheritdoc} */ public function setConfiguration(array $configuration) { $config = $this->configFactory->getEditable('diff.plugins'); $field_type = $configuration['#field_type']; unset($configuration['#field_type']); $field_type_settings = array(); foreach ($configuration as $key => $value) { $field_type_settings[$key] = $value; } $settings = array('type' => $this->pluginId, 'settings' => $field_type_settings); $config->set('field_types.' . $field_type, $settings); $config->save(); }
/** * {@inheritdoc} */ public function uninstall(array $theme_list) { $extension_config = $this->configFactory->getEditable('core.extension'); $theme_config = $this->configFactory->getEditable('system.theme'); $list = $this->listInfo(); foreach ($theme_list as $key) { if (!isset($list[$key])) { throw new \InvalidArgumentException("Unknown theme: {$key}."); } if ($key === $theme_config->get('default')) { throw new \InvalidArgumentException("The current default theme {$key} cannot be uninstalled."); } if ($key === $theme_config->get('admin')) { throw new \InvalidArgumentException("The current admin theme {$key} cannot be uninstalled."); } // Base themes cannot be uninstalled if sub themes are installed, and if // they are not uninstalled at the same time. // @todo https://www.drupal.org/node/474684 and // https://www.drupal.org/node/1297856 themes should leverage the module // dependency system. if (!empty($list[$key]->sub_themes)) { foreach ($list[$key]->sub_themes as $sub_key => $sub_label) { if (isset($list[$sub_key]) && !in_array($sub_key, $theme_list, TRUE)) { throw new \InvalidArgumentException("The base theme {$key} cannot be uninstalled, because theme {$sub_key} depends on it."); } } } } $this->cssCollectionOptimizer->deleteAll(); $current_theme_data = $this->state->get('system.theme.data', array()); foreach ($theme_list as $key) { // The value is not used; the weight is ignored for themes currently. $extension_config->clear("theme.{$key}"); // Remove the theme from the current list. unset($this->list[$key]); // Update the current theme data accordingly. unset($current_theme_data[$key]); // Reset theme settings. $theme_settings =& drupal_static('theme_get_setting'); unset($theme_settings[$key]); // @todo Remove system_list(). $this->systemListReset(); // Remove all configuration belonging to the theme. $this->configManager->uninstall('theme', $key); } $extension_config->save(); $this->state->set('system.theme.data', $current_theme_data); $this->resetSystem(); $this->moduleHandler->invokeAll('themes_uninstalled', [$theme_list]); }
/** * {@inheritdoc} */ public function delete($type, $name) { $full_name = $this->getFullName($type, $name); if (!$full_name) { return FALSE; } $config = $this->configFactory->getEditable($full_name); if (!$config) { return FALSE; } $config->delete(); // Trigger an event notifying of this change. $event = new ConfigRevertEvent($type, $name); $this->dispatcher->dispatch(ConfigDeleteInterface::DELETE, $event); return TRUE; }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); // Save the default language if changed. $new_id = $form_state->getValue('site_default_language'); if ($new_id != $this->languageManager->getDefaultLanguage()->getId()) { $this->configFactory->getEditable('system.site')->set('default_langcode', $new_id)->save(); $this->languageManager->reset(); } if ($this->languageManager instanceof ConfigurableLanguageManagerInterface) { $this->languageManager->updateLockedLanguageWeights(); } drupal_set_message(t('Configuration saved.')); // Force the redirection to the page with the language we have just // selected as default. $form_state->setRedirectUrl($this->entities[$new_id]->urlInfo('collection', array('language' => $this->entities[$new_id]))); }
/** * {@inheritdoc} */ protected function doSave($id, EntityInterface $entity) { $is_new = $entity->isNew(); $prefix = $this->getPrefix(); $config_name = $prefix . $entity->id(); if ($id !== $entity->id()) { // Renaming a config object needs to cater for: // - Storage needs to access the original object. // - The object needs to be renamed/copied in ConfigFactory and reloaded. // - All instances of the object need to be renamed. $this->configFactory->rename($prefix . $id, $config_name); } $config = $this->configFactory->getEditable($config_name); // Retrieve the desired properties and set them in config. $config->setData($this->mapToStorageRecord($entity)); $config->save(); return $is_new ? SAVED_NEW : SAVED_UPDATED; }
/** * Testing the form save function of the values. * * Checking that values are stored correctly in the configuration. */ public function testSaveSettingsForm() { $admin_form = new AdminForm($this->configFactory, $this->mailManager, $this->moduleHandler, $this->themeHandler); $config = $this->configFactory->getEditable('mailsystem.settings'); $form = array(); // Global configuration. $form_state = new FormState(); $form_state->setValues(array('mailsystem' => array('default_formatter' => 'mailsystem_test', 'default_sender' => 'mailsystem_demo', 'default_theme' => 'test_theme'))); $admin_form->submitForm($form, $form_state); $this->assertEquals('mailsystem_test', $config->get('defaults.formatter'), 'Default formatter changed'); $this->assertEquals('mailsystem_demo', $config->get('defaults.sender'), 'Default sender changed'); $this->assertEquals('test_theme', $config->get('theme'), 'Default theme changed'); // Override a custom module setting with no mail key. $form_state = new FormState(); $form_state->setValues(array('custom' => array('custom_module' => 'module_one', 'custom_module_key' => 'mail_key', 'custom_formatter' => 'mailsystem_test', 'custom_sender' => 'mailsystem_demo'))); $admin_form->submitForm($form, $form_state); $base = MailsystemManager::MAILSYSTEM_MODULES_CONFIG . '.module_one.mail_key'; $this->assertEquals('mailsystem_test', $config->get($base . '.' . MailsystemManager::MAILSYSTEM_TYPE_FORMATTING), 'Module one formatter changed'); $this->assertEquals('mailsystem_demo', $config->get($base . '.' . MailsystemManager::MAILSYSTEM_TYPE_SENDING), 'Module one sender changed'); // Override a custom module setting with a mail key and no sender. $form_state = new FormState(); $form_state->setValues(array('custom' => array('custom_module' => 'module_two', 'custom_module_key' => '', 'custom_formatter' => 'mailsystem_test', 'custom_sender' => 'none'))); $admin_form->submitForm($form, $form_state); $base = MailsystemManager::MAILSYSTEM_MODULES_CONFIG . '.module_two.none'; $this->assertEquals('mailsystem_test', $config->get($base . '.' . MailsystemManager::MAILSYSTEM_TYPE_FORMATTING), 'Module two with no key formatter changed'); $this->assertEquals(NULL, $config->get($base . '.' . MailsystemManager::MAILSYSTEM_TYPE_SENDING), 'Module two with no key sender changed to nothing'); // Add a custom module setting with a mail key and no sender. $form_state = new FormState(); $form_state->setValues(array('custom' => array('custom_module' => 'module_three', 'custom_module_key' => 'mail_key', 'custom_formatter' => 'none', 'custom_sender' => 'mailsystem_test'))); $admin_form->submitForm($form, $form_state); $base = MailsystemManager::MAILSYSTEM_MODULES_CONFIG . '.module_three.mail_key'; $this->assertEquals(NULL, $config->get($base . '.' . MailsystemManager::MAILSYSTEM_TYPE_FORMATTING), 'Module three no formatter added'); $this->assertEquals('mailsystem_test', $config->get($base . '.' . MailsystemManager::MAILSYSTEM_TYPE_SENDING), 'Module three sender added'); // Clear the configuration for some modules. $form_state = new FormState(); $form_state->setValues(array('custom' => array('modules' => array('module_two' => 'module_two', 'module_one' => 'not_clean')))); $admin_form->submitForm($form, $form_state); $this->assertEquals('mailsystem_test', $config->get(MailsystemManager::MAILSYSTEM_MODULES_CONFIG . '.module_three.mail_key.' . MailsystemManager::MAILSYSTEM_TYPE_SENDING), 'After clean, module three exists'); $this->assertEquals('mailsystem_demo', $config->get(MailsystemManager::MAILSYSTEM_MODULES_CONFIG . '.module_one.mail_key.' . MailsystemManager::MAILSYSTEM_TYPE_SENDING), 'After clean, module one exists'); $this->assertEquals(NULL, $config->get(MailsystemManager::MAILSYSTEM_MODULES_CONFIG . '.module_two'), 'After clean, module two does not exists'); }
/** * {@inheritdoc} */ public function saveTranslation(JobItemInterface $job_item, $target_langcode) { try { $config_mapper = $this->getMapper($job_item); } catch (TMGMTException $e) { $job_item->addMessage('The entity %id of type %type does not exist, the job can not be completed.', array('%id' => $job_item->getItemId(), '%type' => $job_item->getItemType()), 'error'); return FALSE; } $data = $job_item->getData(); $config_names = $config_mapper->getConfigNames(); // We need to refactor the array just as we did in getData. if (count($config_names) == 1) { $data[$config_names[0]] = $data; } else { // Replace the arrays keys back. foreach ($data as $key => $value) { $new_key = str_replace('__', '.', $key); $data[$new_key] = $value; unset($data[$key]); } } foreach ($config_mapper->getConfigNames() as $name) { $schema = $this->typedConfig->get($name); // Set configuration values based on form submission and source values. $base_config = $this->configFactoryManager->getEditable($name); $config_translation = $this->languageManager->getLanguageConfigOverride($target_langcode, $name); $element = ConfigTranslationFormBase::createFormElement($schema); $element->setConfig($base_config, $config_translation, $this->convertToTranslation($data[$name])); // If no overrides, delete language specific configuration file. $saved_config = $config_translation->get(); if (empty($saved_config)) { $config_translation->delete(); } else { $config_translation->save(); } } return TRUE; }
/** * {@inheritdoc} */ function saveConfiguration($type, $enabled_methods) { // As configurable language types might have changed, we reset the cache. $this->languageManager->reset(); $definitions = $this->getNegotiationMethods(); $default_types = $this->languageManager->getLanguageTypes(); // Order the language negotiation method list by weight. asort($enabled_methods); foreach ($enabled_methods as $method_id => $weight) { if (isset($definitions[$method_id])) { $method = $definitions[$method_id]; // If the language negotiation method does not express any preference // about types, make it available for any configurable type. $types = array_flip(!empty($method['types']) ? $method['types'] : $default_types); // Check whether the method is defined and has the right type. if (!isset($types[$type])) { unset($enabled_methods[$method_id]); } } else { unset($enabled_methods[$method_id]); } } $this->configFactory->getEditable('language.types')->set('negotiation.' . $type . '.enabled', $enabled_methods)->save(); }
/** * {@inheritdoc} */ public function remove() { $this->configFactory->getEditable('features.bundles')->clear($this->getMachineName())->save(); }
/** * Constructs a ExcludeNodeTitleManager object. * * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The config factory. * @param \Drupal\Core\Entity\EntityTypeManagerInterface * The entity type manager. * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $bundle_info * The bundle info manager. */ public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $bundle_info) { $this->settingsConfig = $config_factory->getEditable('exclude_node_title.settings'); $this->entityTypeManager = $entity_type_manager; $this->bundleInfo = $bundle_info; }
/** * Constructs a Config destination object. * * @param array $configuration * A configuration array containing information about the plugin instance. * @param string $plugin_id * The plugin ID for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. * @param \Drupal\migrate\Entity\MigrationInterface $migration * The migration entity. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The configuration factory. */ public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, ConfigFactoryInterface $config_factory) { parent::__construct($configuration, $plugin_id, $plugin_definition, $migration); $this->config = $config_factory->getEditable($configuration['config_name']); }