comparison core/modules/config_translation/src/ConfigEntityMapper.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
11 use Drupal\Core\Routing\RouteProviderInterface; 11 use Drupal\Core\Routing\RouteProviderInterface;
12 use Drupal\Core\StringTranslation\TranslationInterface; 12 use Drupal\Core\StringTranslation\TranslationInterface;
13 use Drupal\Core\Url; 13 use Drupal\Core\Url;
14 use Drupal\locale\LocaleConfigManager; 14 use Drupal\locale\LocaleConfigManager;
15 use Symfony\Component\DependencyInjection\ContainerInterface; 15 use Symfony\Component\DependencyInjection\ContainerInterface;
16 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
16 use Symfony\Component\Routing\Route; 17 use Symfony\Component\Routing\Route;
17 18
18 /** 19 /**
19 * Configuration mapper for configuration entities. 20 * Configuration mapper for configuration entities.
20 */ 21 */
71 * The string translation manager. 72 * The string translation manager.
72 * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager 73 * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
73 * The entity manager. 74 * The entity manager.
74 * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager 75 * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
75 * The language manager. 76 * The language manager.
76 */ 77 * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
77 public function __construct($plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, LocaleConfigManager $locale_config_manager, ConfigMapperManagerInterface $config_mapper_manager, RouteProviderInterface $route_provider, TranslationInterface $translation_manager, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager) { 78 * The event dispatcher.
78 parent::__construct($plugin_id, $plugin_definition, $config_factory, $typed_config, $locale_config_manager, $config_mapper_manager, $route_provider, $translation_manager, $language_manager); 79 */
80 public function __construct($plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, LocaleConfigManager $locale_config_manager, ConfigMapperManagerInterface $config_mapper_manager, RouteProviderInterface $route_provider, TranslationInterface $translation_manager, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, EventDispatcherInterface $event_dispatcher = NULL) {
81 parent::__construct($plugin_id, $plugin_definition, $config_factory, $typed_config, $locale_config_manager, $config_mapper_manager, $route_provider, $translation_manager, $language_manager, $event_dispatcher);
79 $this->setType($plugin_definition['entity_type']); 82 $this->setType($plugin_definition['entity_type']);
80 83
81 $this->entityManager = $entity_manager; 84 $this->entityManager = $entity_manager;
82 } 85 }
83 86
95 $container->get('locale.config_manager'), 98 $container->get('locale.config_manager'),
96 $container->get('plugin.manager.config_translation.mapper'), 99 $container->get('plugin.manager.config_translation.mapper'),
97 $container->get('router.route_provider'), 100 $container->get('router.route_provider'),
98 $container->get('string_translation'), 101 $container->get('string_translation'),
99 $container->get('entity.manager'), 102 $container->get('entity.manager'),
100 $container->get('language_manager') 103 $container->get('language_manager'),
104 $container->get('event_dispatcher')
101 ); 105 );
102 } 106 }
103 107
104 /** 108 /**
105 * {@inheritdoc} 109 * {@inheritdoc}
106 */ 110 */
107 public function populateFromRouteMatch(RouteMatchInterface $route_match) { 111 public function populateFromRouteMatch(RouteMatchInterface $route_match) {
108 parent::populateFromRouteMatch($route_match);
109 $entity = $route_match->getParameter($this->entityType); 112 $entity = $route_match->getParameter($this->entityType);
110 $this->setEntity($entity); 113 $this->setEntity($entity);
114 parent::populateFromRouteMatch($route_match);
111 } 115 }
112 116
113 /** 117 /**
114 * Gets the entity instance for this mapper. 118 * Gets the entity instance for this mapper.
115 * 119 *
261 // Add entity upcasting information. 265 // Add entity upcasting information.
262 $parameters = $route->getOption('parameters') ?: []; 266 $parameters = $route->getOption('parameters') ?: [];
263 $parameters += [ 267 $parameters += [
264 $this->entityType => [ 268 $this->entityType => [
265 'type' => 'entity:' . $this->entityType, 269 'type' => 'entity:' . $this->entityType,
266 ] 270 ],
267 ]; 271 ];
268 $route->setOption('parameters', $parameters); 272 $route->setOption('parameters', $parameters);
269 } 273 }
270 274
271 } 275 }