diff --git a/core/modules/views/src/Plugin/views/display/Page.php b/core/modules/views/src/Plugin/views/display/Page.php index 12408f83d2..00dd83b3e8 100644 --- a/core/modules/views/src/Plugin/views/display/Page.php +++ b/core/modules/views/src/Plugin/views/display/Page.php @@ -55,7 +55,7 @@ class Page extends PathPluginBase { * * @var \Drupal\Core\Menu\MenuParentFormSelectorInterface */ - protected $parentMenuSelector; + protected $parentFormSelector; /** * Constructs a Page object. @@ -72,13 +72,13 @@ class Page extends PathPluginBase { * The state key value store. * @param \Drupal\Core\Entity\EntityStorageInterface $menu_storage * The menu storage. - * @param \Drupal\Core\Menu\MenuParentFormSelectorInterface $parent_menu_selector + * @param \Drupal\Core\Menu\MenuParentFormSelectorInterface $parent_form_selector * The parent form selector service. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteProviderInterface $route_provider, StateInterface $state, EntityStorageInterface $menu_storage, MenuParentFormSelectorInterface $parent_menu_selector) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteProviderInterface $route_provider, StateInterface $state, EntityStorageInterface $menu_storage, MenuParentFormSelectorInterface $parent_form_selector) { parent::__construct($configuration, $plugin_id, $plugin_definition, $route_provider, $state); $this->menuStorage = $menu_storage; - $this->parentMenuSelector = $parent_menu_selector; + $this->parentFormSelector = $parent_form_selector; } /** @@ -324,7 +324,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // Only display the parent selector if Menu UI module is enabled. $menu_parent = $menu['menu_name'] . ':' . $menu['parent']; $menu_link = 'views_view:views.' . $form_state->get('view')->id() . '.' . $form_state->get('display_id'); - $form['menu']['parent'] = $this->parentMenuSelector->parentSelectElement($menu_parent, $menu_link); + $form['menu']['parent'] = $this->parentFormSelector->parentSelectElement($menu_parent, $menu_link); $form['menu']['parent'] += [ '#title' => $this->t('Parent'), '#description' => $this->t('The maximum depth for a link and all its children is fixed. Some menu links may not be available as parents if selecting them would exceed this limit.'), diff --git a/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php b/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php index d448252c6f..6835b2e6b5 100644 --- a/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php +++ b/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php @@ -9,6 +9,7 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Menu\MenuParentFormSelector; use Drupal\Tests\UnitTestCase; use Drupal\views\Entity\View; use Drupal\views\ViewExecutableFactory; @@ -82,9 +83,10 @@ public function testBuildRowEntityList() { $route_provider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface'); $state = $this->getMock('\Drupal\Core\State\StateInterface'); $menu_storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface'); + $parent_form_selector = $this->createMock(MenuParentFormSelector::class); $page_display = $this->getMock('Drupal\views\Plugin\views\display\Page', ['initDisplay', 'getPath'], - [[], 'default', $display_manager->getDefinition('page'), $route_provider, $state, $menu_storage] + [[], 'default', $display_manager->getDefinition('page'), $route_provider, $state, $menu_storage, $parent_form_selector] ); $page_display->expects($this->any()) ->method('getPath')