4

I have a site that heavily uses the book module to organize hierarchical documents. I would like to include a View in a Book Outline.

Here is a simplified example: The Parts Department of a company has documentation of all of its standard operating procedures. These procedures are organized using Drupal's book outline. The department also uses a content type called "Part" to individually enter descriptions of each part. A view was created to display a glossary of parts. This glossary should be in the book outline, but I cannot find a way to insert a view into a book outline.

Example: Parts Department Standard Operating Procedures

  1. Page: Procedure 1
  2. Page: Procedure 2
    1. Page: Detail A
    2. Page: Detail B
  3. Page: Procedure 3
    1. Page: Detail A
    2. Page: Detail B
    3. Page: Detail C
  4. View: glossary of parts -- NEED TO GET THIS INTO BOOK OUTLINE.

Thanks for your help.

Jordan

1
1

I'm not sure if this was the best option, but ultimately, I had a time deadline and this is how I solved my problem of including my glossary views in a book outline:

  1. Created pages A-Z as regular book page nodes. Assigned URL paths /book-root/glossary/a, /book-root/glossary/b, etc.
  2. Created a "node template" panel variant for glossary pages.
  3. Populated panel variant with a view content pane that displays the correct page of my view based on context from the /a, /b, /c, etc., in my node URLs.
1
  • I should mention that if there is a better way, I'd still love to know about it.
    – mlibjh
    Jul 26 '12 at 17:59
1

Create a blank book page called Glossary (or whatever), then add a Block display to the view, and make that block show up on the book page's path.

You'll have to use AJAX if you have exposed forms because without AJAX the exposed form won't work (show) when used as a block.

(I would also like to know whether it's possible to include other paths into a book's outline because there are cases when view-as-a-block doesn't suit.)

1
  • Having looked at the tables, the answer is No. The book table has a nid (Node Id) field. However, it uses the menu_links table, which does not require nids so there may be a way to hack it, but it would be difficult to maintain that. Apr 23 '14 at 10:18
1

You can use the Views Field module, to embed a view into. Here is a quote about it (from the module's project page):

Allows field tables to be used as base tables with Views.

On a field settings form, you may select:

  • to expose the field table as a base table
  • the columns of the field table to expose (e.g., entity_type, entity_id, and delta)

Multiple "exposed" field tables may be related by a multi-column join using the primary key columns. This module provides a programmatic interface to trigger this relation. A user interface is provided by the combination of the Field Group and Field group views modules.

One use case is to generate a table using columns from one or more field tables. As the field tables are treated as standard base tables, the Field API handling of the "field" is not invoked. Thus, by default, the raw value in each column of the field table is displayed.

By relating field tables, the individual columns of each table function as if they were part of a single table.

2
  • Thanks for the help, gilzero. I played around with Views Field for a while, and I'm not sure it will accomplish what I'm trying to do -- or I don't know how to use it. Do you have any tips for implementing this?
    – mlibjh
    May 23 '12 at 0:17
  • 1
    Add a Viewfield to the Book content type, then you may select a View on the Book node's edit screen which will then be displayed on that book node. The Viewfield module allows you to select any View from a list to be rendered as that field. Sep 2 '15 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.