diff --git a/lib/Drupal/config_translation/ConfigMapperManager.php b/lib/Drupal/config_translation/ConfigMapperManager.php index 0c93711..b8da0ec 100644 --- a/lib/Drupal/config_translation/ConfigMapperManager.php +++ b/lib/Drupal/config_translation/ConfigMapperManager.php @@ -50,11 +50,12 @@ class ConfigMapperManager extends DefaultPluginManager { */ public function getMappers() { $mappers = array(); - foreach($this->getDefinitions() as $definition) { + foreach($this->getDefinitions() as $id => $definition) { if ($definition['type'] == 'entity') { $mapper = new ConfigEntityMapper( $definition['base_path'], $definition['title'], + $id, array(), constant($definition['menu_item_type']), $definition['add_edit_tab'] @@ -65,6 +66,7 @@ class ConfigMapperManager extends DefaultPluginManager { $mapper = new ConfigNamesMapper( $definition['base_path'], $definition['title'], + $id, $definition['names'], constant($definition['menu_item_type']), $definition['add_edit_tab'] diff --git a/lib/Drupal/config_translation/ConfigNamesMapper.php b/lib/Drupal/config_translation/ConfigNamesMapper.php index c0ef0c3..4e8e3cd 100644 --- a/lib/Drupal/config_translation/ConfigNamesMapper.php +++ b/lib/Drupal/config_translation/ConfigNamesMapper.php @@ -57,6 +57,8 @@ class ConfigNamesMapper { */ protected $routeName; + protected $id; + /** * Constructor for configuration names mapper. * @@ -64,6 +66,8 @@ class ConfigNamesMapper { * Base path pattern to attach the translation user interface to. * @param string $title * Title for translation editing screen. + * @param string $id + * The config mapper plugin ID. * @param array $names * List of configuration names for this mapper. * @param int $menu_item_type @@ -73,12 +77,13 @@ class ConfigNamesMapper { * no existing tabs on the page, for the translation tab to show up, an * edit tab will need to be added. */ - function __construct($base_path_pattern, $title, $names = array(), $menu_item_type = MENU_LOCAL_TASK, $add_edit_tab = FALSE) { + function __construct($base_path_pattern, $title, $id, $names = array(), $menu_item_type = MENU_LOCAL_TASK, $add_edit_tab = FALSE) { $this->basePathPattern = $base_path_pattern; $this->title = $title; $this->names = $names; $this->menuItemType = $menu_item_type; $this->addEditTab = $add_edit_tab; + $this->id = $id; // Set route name based on base path. $search = array('/', '-', '{', '}'); @@ -87,6 +92,15 @@ class ConfigNamesMapper { } /** + * Returns the config name mapper plugin ID. + * + * @return string + */ + public function getId() { + return $this->id; + } + + /** * Populate the config mapper with request data. * * @param \Symfony\Component\HttpFoundation\Request $request