Skip to content

Shared menu

Requirements

  • Configurable;
  • Cannot be removed by an author;
  • Shared between a root page and every descendant of this page (children, grandchildren, …), even if they use different templates or page components;
  • Editable only from the root page.

Step by step solution

  1. Add an iparsys to the root page template and a menu instance to this iparsys;
  2. Statically include the menu instance in the root page component;
  3. Create a page template and a page component for the descendant pages;
  4. Add an empty iparsys to the descendant page template, using the same name of the iparsys defined in (1);
  5. Include that iparsys in the descendant page component, setting its wcmmode to disabled;
  6. You may also need

How does it work?

Iparsys takes care of the content inheritance between a page and its child pages. Since we have a single instance of iparsys (the one defined at the root page template), we’ll end up with all descendants referring to the exactly same instance.

By including the menu instance in the root page component instead of including its container iparsys, we disable the author’s ability of moving/removing the menu instance and the ability of adding more components to that iparsys.

Then setting wcmmode to disabled, at the descendant page component, is enough to ensure that an author won’t be able to break or override the iparsys inheritance.

As usual, a sample project can be found on GitHub.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *