Hi,

I cannot assign a view (page display) to a menu.

To reproduce,

(1) install latest dev of Drupal (I used commit 9c12817)
(2) as user 1 create a view with machine name "gallery", with a page display, and save it
(3) go edit the view at admin/structure/views/view/gallery
(4) click on Menu: no menu item in the page settings area
(5) select normal menu entry
(6) I am expecting to see a drop down with available menus, but there is no such dropdown (as there is in Views for D7)

As a workaround, you can create a new menu item from the menu settings admin area.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alberto56’s picture

Here is a screenshot of what I mean.

dawehner’s picture

mhhh there should be actually a parent menu selector, odd.

dawehner’s picture

Priority: Normal » Major
Status: Active » Needs review
FileSize
1.78 KB

here is a patch.

Status: Needs review » Needs work

The last submitted patch, 3: menu.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
Issue tags: +VDC
FileSize
4.56 KB
2.78 KB

Haha, did I really thought that this is a simple issue?

Status: Needs review » Needs work

The last submitted patch, 5: views-menu-2323511-5.patch, failed testing.

Xano’s picture

Status: Needs work » Needs review
FileSize
859 bytes
5.4 KB

Part of the problem was that the menu parent selector did not return a selection element at all if the default value was invalid or empty.

Status: Needs review » Needs work

The last submitted patch, 7: drupal_2323511_7.patch, failed testing.

dawehner’s picture

@Xano
I thought this was done on purpose?

dawehner’s picture

Status: Needs work » Needs review
FileSize
5.37 KB
1.29 KB

There we go.

Status: Needs review » Needs work

The last submitted patch, 10: menu-2323511-9.patch, failed testing.

dawehner’s picture

FileSize
3.88 KB
1.45 KB

Here is a test.

dawehner’s picture

Status: Needs work » Needs review
FileSize
5.09 KB
575 bytes

#12 was a different issue. Reversed the out of scope/buggy change

Status: Needs review » Needs work

The last submitted patch, 13: menu-2323511-13.patch, failed testing.

dawehner queued 13: menu-2323511-13.patch for re-testing.

The last submitted patch, 13: menu-2323511-13.patch, failed testing.

Xano’s picture

I thought this was done on purpose?

I don't know why it was done, but it's inconsistent with how we handle form elements elsewhere (default values do not influence the available options) and it directly prevented the selector from showing for new page displays. The only other option would have been to set a sensible parent item value in the page display by default, and to keep the value valid throughout the page's lifetime, which is harder to do.

dawehner’s picture

I don't know why it was done, but it's inconsistent with how we handle form elements elsewhere (default values do not influence the available options) and it directly prevented the selector from showing for new page displays. The only other option would have been to set a sensible parent item value in the page display by default, and to keep the value valid throughout the page's lifetime, which is harder to do.

Well, this is an entire different discussion. The interface clearly says that in case you have no matching $menu_parent, the resulting array will be empy. Showing

dawehner’s picture

Status: Needs work » Needs review
FileSize
9.11 KB
4.34 KB

Fixed it.

Status: Needs review » Needs work

The last submitted patch, 19: menu-2323511-19.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
9.11 KB
640 bytes

Muh.

Status: Needs review » Needs work

The last submitted patch, 21: menu-2323511-21.patch, failed testing.

olli’s picture

Status: Needs work » Needs review
FileSize
9.15 KB
755 bytes

reroll

Gábor Hojtsy’s picture

Priority: Major » Critical

Marked #2343581: Not possible to assign menu item to existing view unless it already has a menu item a duplicate. That was critical, so elevating this one as well.

Gábor Hojtsy’s picture

Issue tags: +D8MIAMS, +Amsterdam2014

Marking for D8MIAMS which are the issues we'd love to get solved for the D8 multilingual site building lab on Wed. We do create some views. I looked into reviewing this issue but I don't think I have the background info that would be useful to asses why all the changes are going on in blocks, displays, etc :/

xjm’s picture

Issue tags: +Needs tests
kattekrab’s picture

I just followed the instructions in the issue summary on simplytest.me - and am definitely now seeing a drop down to choose the menu.

Screen grab:

dawehner’s picture

FileSize
13.01 KB
2.18 KB
pfrenssen’s picture

  1. +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_menu.yml
    @@ -97,6 +97,24 @@ display:
    +  page_5:
    +    display_options:
    +      path: test-path
    +      title: 'Tests a menu with a not existing parent'
    

    Use "non-existing parent" instead of "not existing parent".

  2. +++ b/core/modules/views_ui/src/Tests/DisplayPathTest.php
    @@ -16,13 +16,20 @@
       /**
    +   * Modules to enable.
    +   *
    +   * @var array
    +   */
    +  public static $modules = array('menu_ui');
    +
    

    Use {@inheritdoc}.

  3. +++ b/core/modules/views_ui/src/Tests/DisplayPathTest.php
    @@ -16,13 +16,20 @@
    -  public function testPathUI() {
    +  public function ptestPathUI() {
         $this->doBasicPathUITest();
    

    This test shouldn't be disabled.

  4. +++ b/core/modules/views_ui/src/Tests/DisplayPathTest.php
    @@ -63,7 +70,7 @@ protected function doAdvancedPathsValidationTest() {
    -  public function testDeleteWithNoPath() {
    +  public function ptestDeleteWithNoPath() {
    

    Test is disabled.

During testing I get an exception when assigning a menu item to a Views page and then disabling the view:

Uncaught PHP Exception Symfony\Component\Routing\Exception\RouteNotFoundException: "Route "view.bdsggds.page_1" does not exist." at /home/pieter/v/drupal/drupal/core/lib/Drupal/Core/Routing/RouteProvider.php line 147

pfrenssen’s picture

Issue tags: -Needs tests
FileSize
12.67 KB
3.36 KB

I can't replicate the exception any more :-/

I fixed my remarks and did some little cleanups.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

I have one question about this patch, but this is a pretty weird bug, so that shouldn't hold this up. Hence, marking RTBC.

  1. +++ b/core/modules/views/src/Plugin/views/display/Block.php
    @@ -316,14 +355,16 @@ public function usesExposed() {
    +    if ($this->entityManager->hasDefinition('block')) {
    

    It might be that I'm missing something but why would the Block display even be available at all, if block module is not installed? I.e. wouldn't it be also possible to just declare provider = "block" in the annotation? May be a separate issue, though.

  2. +++ b/core/modules/views_ui/src/Tests/DisplayPathTest.php
    @@ -96,6 +103,25 @@ public function testMenuOptions() {
    +    $menu_options = (array) $menu_parent[0]->option;
    +    unset($menu_options['@attributes']);
    

    Awesome trick!!!

webchick’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
12.67 KB

Hm. Trying to kick the bot a bit.

webchick’s picture

Status: Needs review » Reviewed & tested by the community
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

  • webchick committed f140282 on 8.0.x
    Issue #2323511 by dawehner, pfrenssen, olli, Xano | alberto56: Fixed...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.