System Info:

PHP 5.6.24-1+deb.sury.org~trusty+1 (cli) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Linux tst-full1 3.13.0-86-generic #131-Ubuntu SMP Thu May 12 23:33:13 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Server version: Apache/2.4.7 (Ubuntu)
Server built:   Jul 15 2016 15:34:04
 MYSQL
Server version: 5.5.50-0ubuntu0.14.04.1-log (Ubuntu)

The Book Navigation Block provides two utilities to a user browsing book nodes:

1. Forward and Backward links to the previous and next pages of the book
2. A book outline button which should drop down to display all the pages of the book

When the book navigation block is added to book nodes, the Book Outline button does not expand when clicked.

Steps to reproduce:

1. Install fresh site (WETKit 4.10)

2. Choose WETKit Bootstrap Theme

3. Enable Book Module

4. Edit Book Page content type ( /admin/structure/types/manage/book )
a) Click Panelizer tab on left and enable the Panelize checkbox
b) Enable the Full Page Override checkbox and provide a default initial display

5. Continue editing the Book page and click the Panelizer tab at the top ( /en/admin/structure/types/manage/book/panelizer )
a) Select Full Page Override
b) Click on Content
c) Add content to Center
d) Choose Page Content
e) Add "Book Navigation"

6. Create a Book Page
a) add dummy content (title/body)
b) Set book to "Create a new book"

7. Create another Book Page
a) add dummy content
b) Set book to the previously created book page (the parent)

8. Navigate to the either of the book pages, and try to expand the Book Outline button.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

adventurist created an issue. See original summary.

logicp’s picture

Issue summary: View changes
logicp’s picture

Issue summary: View changes
logicp’s picture

Issue summary: View changes
sylus’s picture

FileSize
104.8 KB

Thanks for the detailed reproduction case. I don't use panelizer that often as it used to be quite buggy compared to the stability of panels / page manager so steps definitely helped me.

I did notice one immediate thing:

You should go to the book content type @ admin/structure/types/manage/book/fields and make sure the title is replaced by a field instance using title_field and entity translation. Book sets it up initially as not having that.

Anyways the error I do see is:

Notice: Trying to get property of non-object in node_page_title...

Which looks reported over in a few issues:

#2302513: Book ToC generating errors
#1978176: Build menu_tree without loading so many objects

The latest patch from the below issue seems to resolve the error and if I inspect source I can see the title is now showing up in the outline view rather then just an a href tag that has a link but no title before the unordered list. The dropdown is still not working on hover which I think is the last thing I need to look at. The picture below just has the css that is hiding the .dropdown-menu disabled.

https://www.drupal.org/files/issues/drupal-1978176-menu_load_objects-75....

I have attached a picture.

sylus’s picture

FileSize
48.46 KB
36.99 KB

Alright I have figured this out the problem is at some point the book logic was adopted to make use of bootstrap's dropdown-toggle attribute which requires the dropdown.js file and doesn't have graceful degradation if that file is not present to appear as a standard menu with nested ul's. Hence why the deletion of the book templates from wxt_bootstrap + bootstrap allows for the native book module rendering to take over and all links appear. While wet-boew is compiled from bootstrap it doesn't ship with the dropdown.js file. See https://github.com/wet-boew/wet-boew/issues/6156

However in your sub-theme and in wetkit_bootstrap.info you can see the following section:

; ========================================
; Scripts
; ========================================
;scripts[] = bootstrap/js/affix.js
;scripts[] = bootstrap/js/alert.js
;scripts[] = bootstrap/js/button.js
;scripts[] = bootstrap/js/carousel.js
;scripts[] = bootstrap/js/collapse.js
;scripts[] = bootstrap/js/dropdown.js
...

Simply go to https://github.com/twbs/bootstrap/tree/master/js and grab the appropriate file (dropdown.js) to place in your sub-theme. Then when hovering over outline you can now interact with the book module and it will look like below:

Dropdown Toggle

The larger problem is the accessibility concerns raised by the wet-boew team over the button drop down functionality and why they don't currently ship with this behaviour. If we wanted to bring back the native book functionality I attached a reset patch that was able to get it to render similar to the following but would still need work.

Native Book

sylus’s picture

logicp’s picture

Thanks again, Sylus!

I was able to apply the patch perfectly to 4.8, but had to apply it manually my development project based on 4.10. Even the line numbers matched, however, so perhaps it's because of a change on my end. I will follow up on that.

With respect to the structure of $variables['tree'], neither my development project nor the fresh 4.8-based test site seemed to have any text between the tags, thus it wasn't visible without my putting some placeholder text. Is it possible for me to access each

  • in its own variable so that I can dynamically add text to each link? This is probably not the best way to go about it, but I am looking for a quick fix to establish some functionality in the mean time.

    Sorry for all the questions :) I appreciate your great work.

  • sylus’s picture

    So you have opted for approach #2 and not the dropdown.js method?

    You should always have text between the tags. Not sure what you mean by dynamically adding text as the text is always related to the title of each entry in the book module. On my default setup with the below process, I have never seen an empty tag where there should have been one.

    I would make sure there are no customizations being done since you said the patch couldn't apply which it should on 4.10 up.

    cd wetkit_bootstrap
    wget https://www.drupal.org/files/issues/book_outline_button-2779245-7.patch
    patch -p1 < book_outline_button-2779245-7.patch
    

    Additionally make sure you have this patch (which I think is needed for book titles missing see my comment in #2779245-5: Book Outline Button Does Not Expand on Book Covers:

    https://www.drupal.org/files/issues/drupal-1978176-menu_load_objects-75....

    cd drupal
    wget https://www.drupal.org/files/issues/drupal-1978176-menu_load_objects-75.patch
    patch -p1 < drupal-1978176-menu_load_objects-75.patch
    

    Then on a base WxT install I was able to get book working like the above picture following your steps and creating a few more sub pages.

    logicp’s picture

    Sorry for the delay! Will double check to make sure that patch is being used and get back to you :)

    logicp’s picture

    Greetings!

    Update: Patch now applies. It wasn't previously applying because of some custom edits done while troubleshooting the book outline issue.

    Conclusion: The patches fixed the problem. Book outlines are now properly displaying.

    Thanks again!!

    sylus’s picture

    That is great news!

    I'll try to review the issue below and get it to RTBC. Will keep this issue open till that happens, then will make sure this gets into next release.

    #1978176: Build menu_tree without loading so many objects

    Thanks for your help in tracking this down ^_^

    sylus’s picture

    Status: Active » Fixed

    Bootstrap has been updated with alot of the TOC template improved. For the related issue tracking it now closely at:

    #2828515: speed up rendering of pages with many menu links

    Status: Fixed » Closed (fixed)

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