protected function LingotekConfigSubscriber::getMapperFromConfigName in Lingotek Translation 4.0.x
Same name and namespace in other branches
- 8 src/EventSubscriber/LingotekConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekConfigSubscriber::getMapperFromConfigName()
- 8.2 src/EventSubscriber/LingotekConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekConfigSubscriber::getMapperFromConfigName()
- 3.0.x src/EventSubscriber/LingotekConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekConfigSubscriber::getMapperFromConfigName()
- 3.1.x src/EventSubscriber/LingotekConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekConfigSubscriber::getMapperFromConfigName()
- 3.2.x src/EventSubscriber/LingotekConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekConfigSubscriber::getMapperFromConfigName()
- 3.3.x src/EventSubscriber/LingotekConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekConfigSubscriber::getMapperFromConfigName()
- 3.4.x src/EventSubscriber/LingotekConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekConfigSubscriber::getMapperFromConfigName()
- 3.5.x src/EventSubscriber/LingotekConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekConfigSubscriber::getMapperFromConfigName()
- 3.6.x src/EventSubscriber/LingotekConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekConfigSubscriber::getMapperFromConfigName()
- 3.7.x src/EventSubscriber/LingotekConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekConfigSubscriber::getMapperFromConfigName()
- 3.8.x src/EventSubscriber/LingotekConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekConfigSubscriber::getMapperFromConfigName()
2 calls to LingotekConfigSubscriber::getMapperFromConfigName()
- LingotekConfigSubscriber::onConfigLanguageOverrideDelete in src/
EventSubscriber/ LingotekConfigSubscriber.php - Updates the Lingotek configuration when a field is deleted.
- LingotekConfigSubscriber::onConfigSave in src/
EventSubscriber/ LingotekConfigSubscriber.php - Updates the configuration translation status when a configuration is saved.
File
- src/
EventSubscriber/ LingotekConfigSubscriber.php, line 246
Class
- LingotekConfigSubscriber
- Updates config Lingotek translation status when saved.
Namespace
Drupal\lingotek\EventSubscriberCode
protected function getMapperFromConfigName($name) {
// ToDo: This is inefficient.
$result = NULL;
foreach ($this->mappers as $mapper) {
$names = $mapper
->getConfigNames();
foreach ($names as $the_name) {
if ($the_name === $name) {
$result = $mapper;
break;
}
}
}
if (!$result) {
// It may not be config, but config entity.
/** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */
$config_manager = \Drupal::service('config.manager');
$entity_type_id = $config_manager
->getEntityTypeIdByName($name);
if ($entity_type_id === 'field_config') {
list($field1, $field2, $field_entity_type_id, $field_bundle, $field_id) = explode('.', $name);
$entity_type_id = $field_entity_type_id . '_fields';
}
if (isset($this->mappers[$entity_type_id])) {
$entity = $config_manager
->loadConfigEntityByName($name);
// Maybe the entity is null because we are deleting also the original
// entity, e.g. uninstalling a module.
if ($entity !== NULL) {
$mapper = clone $this->mappers[$entity_type_id];
$mapper
->setEntity($entity);
$result = $mapper;
}
}
}
return $result;
}