Download the PHP package dft/silverstripe-custommenus without Composer

On this page you can find all versions of the php package dft/silverstripe-custommenus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package silverstripe-custommenus

Custom Menus

Scrutinizer Code Quality Code Intelligence Status Build Status

A module to allow the creation of customised menus for your SilverStripe site/App via SiteConfig.

Requirements

SilverStripe 4 or 5

Installation Instructions

The prefered way to install this module is via composer:

composer require dft/silverstripe-custommenus

Alternativley you can download the module:

  1. Download and add the module to the "custommenus" folder in your SilverStripe root folder
  2. Run dev/build?flush=all

Usage

Once the module is downloaded and installed, you can create menus and add pages to them by visiting:

http://www.yourwebsite.com/admin/settings

And then clicking on the "Menus" tab.

You will then need to create a MenuHolder (or use one of the installed defaults).

Now edit the MenuHolder and set the BaseClass (this will usually default to SiteTree). Once you have done this and saved you will be able to associate this menu item with you Page/Object using the ObjectID field.

Templates

CustomMenus comes with two options for rendering menus into a template you can either:

Use the bundled template

Adding $RenderedCustomMenu(menu-slug) to your template code make use of the CustomMenu.ss include to render a UL (with a unique class name).

You can also overload this template in your own theme to generate custom HTML for your navigation.

You can also enable the Title of the menu in the template by calling:

$RenderedCustomMenu(menu-slug, true)

Loop through a list of menu items

Alternativley you can generate your own template by adding the following code:

`

Access to the base CustomMenuHolder

When rendering the menu into a template, you can access the base holder using the $Holder variable, from the example above you can use:

`

Linking to custom DataObjects

By default this module looks for (and utilises) the CMS module (allowing linking to Pages). It is fairly easy though to add links to other DataObjects though.

DataObject Requirements

First off, ensure that your custom DataObject has the following methods available:

Also, ensure the following properties are available:

Add DataObject class

Now, you need to make CustomMenuLink aware of this class. You can do that by adding it (and a description) to your config.yml:

CustomMenuLink:
  base_classes:
    "SiteTree": "Page on site"
    "Product": "A Product"

NOTE You MUST ensure that any data object you want to add to a menu has a defined searchable_fields config variable.

Customising assotiations

Sometimes using the default fields for an object can cause issues (maybe you want to search only MenuTitle for a page, for example).

You can customise how your linked classes are loaded via the following additional config:

CustomMenuLink:
  base_classes:
    'SilverStripe\CMS\Model\SiteTree':
      Title: 'A Page' # Name for this object in the CMS
      Label: 'Title' # The title field used when displaying t he assotiation in the CMS
      SearchFields: # Fields used to search for an assotiated object
        - Title
        - URLSegment
        - StockID

All versions of silverstripe-custommenus with dependencies

PHP Build Version
Package Version
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dft/silverstripe-custommenus contains the following files

Loading the files please wait ....