Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Menu/LocalTaskManager.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 |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
18 use Drupal\Core\Routing\RouteMatchInterface; | 18 use Drupal\Core\Routing\RouteMatchInterface; |
19 use Drupal\Core\Routing\RouteProviderInterface; | 19 use Drupal\Core\Routing\RouteProviderInterface; |
20 use Drupal\Core\Session\AccountInterface; | 20 use Drupal\Core\Session\AccountInterface; |
21 use Drupal\Core\Url; | 21 use Drupal\Core\Url; |
22 use Symfony\Component\HttpFoundation\RequestStack; | 22 use Symfony\Component\HttpFoundation\RequestStack; |
23 use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; | |
23 | 24 |
24 /** | 25 /** |
25 * Provides the default local task manager using YML as primary definition. | 26 * Provides the default local task manager using YML as primary definition. |
26 */ | 27 */ |
27 class LocalTaskManager extends DefaultPluginManager implements LocalTaskManagerInterface { | 28 class LocalTaskManager extends DefaultPluginManager implements LocalTaskManagerInterface { |
49 // The plugin id. Set by the plugin system based on the top-level YAML key. | 50 // The plugin id. Set by the plugin system based on the top-level YAML key. |
50 'id' => '', | 51 'id' => '', |
51 ]; | 52 ]; |
52 | 53 |
53 /** | 54 /** |
55 * An argument resolver object. | |
56 * | |
57 * @var \Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface | |
58 */ | |
59 protected $argumentResolver; | |
60 | |
61 /** | |
54 * A controller resolver object. | 62 * A controller resolver object. |
55 * | 63 * |
56 * @var \Drupal\Core\Controller\ControllerResolverInterface | 64 * @var \Symfony\Component\HttpKernel\Controller\ControllerResolverInterface |
65 * | |
66 * @deprecated | |
67 * Using the 'controller_resolver' service as the first argument is | |
68 * deprecated, use the 'http_kernel.controller.argument_resolver' instead. | |
69 * If your subclass requires the 'controller_resolver' service add it as an | |
70 * additional argument. | |
71 * | |
72 * @see https://www.drupal.org/node/2959408 | |
57 */ | 73 */ |
58 protected $controllerResolver; | 74 protected $controllerResolver; |
59 | 75 |
60 /** | 76 /** |
61 * The request stack. | 77 * The request stack. |
107 protected $account; | 123 protected $account; |
108 | 124 |
109 /** | 125 /** |
110 * Constructs a \Drupal\Core\Menu\LocalTaskManager object. | 126 * Constructs a \Drupal\Core\Menu\LocalTaskManager object. |
111 * | 127 * |
112 * @param \Drupal\Core\Controller\ControllerResolverInterface $controller_resolver | 128 * @param \Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface $argument_resolver |
113 * An object to use in introspecting route methods. | 129 * An object to use in resolving route arguments. |
114 * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack | 130 * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack |
115 * The request object to use for building titles and paths for plugin instances. | 131 * The request object to use for building titles and paths for plugin instances. |
116 * @param \Drupal\Core\Routing\RouteMatchInterface $route_match | 132 * @param \Drupal\Core\Routing\RouteMatchInterface $route_match |
117 * The current route match. | 133 * The current route match. |
118 * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider | 134 * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider |
126 * @param \Drupal\Core\Access\AccessManagerInterface $access_manager | 142 * @param \Drupal\Core\Access\AccessManagerInterface $access_manager |
127 * The access manager. | 143 * The access manager. |
128 * @param \Drupal\Core\Session\AccountInterface $account | 144 * @param \Drupal\Core\Session\AccountInterface $account |
129 * The current user. | 145 * The current user. |
130 */ | 146 */ |
131 public function __construct(ControllerResolverInterface $controller_resolver, RequestStack $request_stack, RouteMatchInterface $route_match, RouteProviderInterface $route_provider, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, AccessManagerInterface $access_manager, AccountInterface $account) { | 147 public function __construct(ArgumentResolverInterface $argument_resolver, RequestStack $request_stack, RouteMatchInterface $route_match, RouteProviderInterface $route_provider, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, AccessManagerInterface $access_manager, AccountInterface $account) { |
132 $this->factory = new ContainerFactory($this, '\Drupal\Core\Menu\LocalTaskInterface'); | 148 $this->factory = new ContainerFactory($this, '\Drupal\Core\Menu\LocalTaskInterface'); |
133 $this->controllerResolver = $controller_resolver; | 149 $this->argumentResolver = $argument_resolver; |
150 if ($argument_resolver instanceof ControllerResolverInterface) { | |
151 @trigger_error("Using the 'controller_resolver' service as the first argument is deprecated, use the 'http_kernel.controller.argument_resolver' instead. If your subclass requires the 'controller_resolver' service add it as an additional argument. See https://www.drupal.org/node/2959408.", E_USER_DEPRECATED); | |
152 $this->controllerResolver = $argument_resolver; | |
153 } | |
134 $this->requestStack = $request_stack; | 154 $this->requestStack = $request_stack; |
135 $this->routeMatch = $route_match; | 155 $this->routeMatch = $route_match; |
136 $this->routeProvider = $route_provider; | 156 $this->routeProvider = $route_provider; |
137 $this->accessManager = $access_manager; | 157 $this->accessManager = $access_manager; |
138 $this->account = $account; | 158 $this->account = $account; |
168 * {@inheritdoc} | 188 * {@inheritdoc} |
169 */ | 189 */ |
170 public function getTitle(LocalTaskInterface $local_task) { | 190 public function getTitle(LocalTaskInterface $local_task) { |
171 $controller = [$local_task, 'getTitle']; | 191 $controller = [$local_task, 'getTitle']; |
172 $request = $this->requestStack->getCurrentRequest(); | 192 $request = $this->requestStack->getCurrentRequest(); |
173 $arguments = $this->controllerResolver->getArguments($request, $controller); | 193 $arguments = $this->argumentResolver->getArguments($request, $controller); |
174 return call_user_func_array($controller, $arguments); | 194 return call_user_func_array($controller, $arguments); |
175 } | 195 } |
176 | 196 |
177 /** | 197 /** |
178 * {@inheritdoc} | 198 * {@inheritdoc} |