Mercurial > hg > isophonics-drupal-site
comparison core/modules/system/src/Plugin/Block/SystemMenuBlock.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | af1871eacc83 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
3 namespace Drupal\system\Plugin\Block; | 3 namespace Drupal\system\Plugin\Block; |
4 | 4 |
5 use Drupal\Core\Block\BlockBase; | 5 use Drupal\Core\Block\BlockBase; |
6 use Drupal\Core\Cache\Cache; | 6 use Drupal\Core\Cache\Cache; |
7 use Drupal\Core\Form\FormStateInterface; | 7 use Drupal\Core\Form\FormStateInterface; |
8 use Drupal\Core\Menu\MenuActiveTrailInterface; | |
9 use Drupal\Core\Menu\MenuLinkTreeInterface; | 8 use Drupal\Core\Menu\MenuLinkTreeInterface; |
10 use Drupal\Core\Plugin\ContainerFactoryPluginInterface; | 9 use Drupal\Core\Plugin\ContainerFactoryPluginInterface; |
11 use Symfony\Component\DependencyInjection\ContainerInterface; | 10 use Symfony\Component\DependencyInjection\ContainerInterface; |
12 | 11 |
13 /** | 12 /** |
15 * | 14 * |
16 * @Block( | 15 * @Block( |
17 * id = "system_menu_block", | 16 * id = "system_menu_block", |
18 * admin_label = @Translation("Menu"), | 17 * admin_label = @Translation("Menu"), |
19 * category = @Translation("Menus"), | 18 * category = @Translation("Menus"), |
20 * deriver = "Drupal\system\Plugin\Derivative\SystemMenuBlock" | 19 * deriver = "Drupal\system\Plugin\Derivative\SystemMenuBlock", |
20 * forms = { | |
21 * "settings_tray" = "\Drupal\system\Form\SystemMenuOffCanvasForm", | |
22 * }, | |
21 * ) | 23 * ) |
22 */ | 24 */ |
23 class SystemMenuBlock extends BlockBase implements ContainerFactoryPluginInterface { | 25 class SystemMenuBlock extends BlockBase implements ContainerFactoryPluginInterface { |
24 | 26 |
25 /** | 27 /** |
26 * The menu link tree service. | 28 * The menu link tree service. |
27 * | 29 * |
28 * @var \Drupal\Core\Menu\MenuLinkTreeInterface | 30 * @var \Drupal\Core\Menu\MenuLinkTreeInterface |
29 */ | 31 */ |
30 protected $menuTree; | 32 protected $menuTree; |
31 | |
32 /** | |
33 * The active menu trail service. | |
34 * | |
35 * @var \Drupal\Core\Menu\MenuActiveTrailInterface | |
36 */ | |
37 protected $menuActiveTrail; | |
38 | 33 |
39 /** | 34 /** |
40 * Constructs a new SystemMenuBlock. | 35 * Constructs a new SystemMenuBlock. |
41 * | 36 * |
42 * @param array $configuration | 37 * @param array $configuration |
45 * The plugin_id for the plugin instance. | 40 * The plugin_id for the plugin instance. |
46 * @param array $plugin_definition | 41 * @param array $plugin_definition |
47 * The plugin implementation definition. | 42 * The plugin implementation definition. |
48 * @param \Drupal\Core\Menu\MenuLinkTreeInterface $menu_tree | 43 * @param \Drupal\Core\Menu\MenuLinkTreeInterface $menu_tree |
49 * The menu tree service. | 44 * The menu tree service. |
50 * @param \Drupal\Core\Menu\MenuActiveTrailInterface $menu_active_trail | 45 */ |
51 * The active menu trail service. | 46 public function __construct(array $configuration, $plugin_id, $plugin_definition, MenuLinkTreeInterface $menu_tree) { |
52 */ | |
53 public function __construct(array $configuration, $plugin_id, $plugin_definition, MenuLinkTreeInterface $menu_tree, MenuActiveTrailInterface $menu_active_trail) { | |
54 parent::__construct($configuration, $plugin_id, $plugin_definition); | 47 parent::__construct($configuration, $plugin_id, $plugin_definition); |
55 $this->menuTree = $menu_tree; | 48 $this->menuTree = $menu_tree; |
56 $this->menuActiveTrail = $menu_active_trail; | |
57 } | 49 } |
58 | 50 |
59 /** | 51 /** |
60 * {@inheritdoc} | 52 * {@inheritdoc} |
61 */ | 53 */ |
62 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { | 54 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { |
63 return new static( | 55 return new static( |
64 $configuration, | 56 $configuration, |
65 $plugin_id, | 57 $plugin_id, |
66 $plugin_definition, | 58 $plugin_definition, |
67 $container->get('menu.link_tree'), | 59 $container->get('menu.link_tree') |
68 $container->get('menu.active_trail') | |
69 ); | 60 ); |
70 } | 61 } |
71 | 62 |
72 /** | 63 /** |
73 * {@inheritdoc} | 64 * {@inheritdoc} |