Skip to content

arillo/silverstripe-elements-menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arillo\Elements\Menu

Latest Stable Version   Total Downloads

Adds inpage menus for Arillo\Elements.

Requirements

SilverStripe CMS ^4.0 arillo/silverstripe-elements >=2.0.5

Installation

Install with composer:

composer require arillo/silverstripe-elements-menu

Usage

PHP

Arillo\Elements\Menu\ElementBaseExtension is already added to Arillo\Elements\ElementBase when this package is installed. You need to use Arillo\Elements\Menu\ElementsMenu in your Page.php e.g.:

<?php

use SilverStripe\CMS\Model\SiteTree;
use Arillo\Elements\Menu\ElementsMenu;

class Page extends SiteTree
{
    // optional configure element relation name you want to use as menu.
    // Default: Elements
    private static $elements_menu_relationname = '<YOUR_RELATION_NAME>';

    // can be used to deactivate inpage-menus for certain SiteTree subclasses.
    private static $disable_elements_menu = true;

    // add this
    use ElementsMenu;
}

Templates

You can use ElementsMenu.ss provided by this module:

<% include ElementsMenu %>

or you might to provide your own markup e.g.:

<% if $ElementsMenuItems.Exists %>
  <ul>
    <% loop $ElementsMenuItems %>
      <li>
        <a href="#$URLSegment">
          <% if $MenuTitle %>$MenuTitle<% else %>$Title<% end_if %>
        </a>
      </li>
    <% end_loop %>
  </ul>
<% end_if %>

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published