Front-end utility menu for SilverStripe websites featuring administration and development tools
Go to file
2019-07-10 13:18:47 +12:00
_config Conversion to a Vendor Module (#40) 2018-03-20 12:24:06 -07:00
css Update login functions for SS4 2017-11-20 11:30:11 -08:00
images Initial commit 2014-08-13 10:11:18 +09:30
javascript Don't upgrade logout link if form doesn't exist (#39) 2018-03-19 15:15:46 -07:00
scss Update login functions for SS4 2017-11-20 11:30:11 -08:00
src/Extension Use locally scoped render for navigator, add shouldShowBetterNavigator() method 2019-07-10 12:56:10 +12:00
templates/BetterNavigator Use locally scoped render for navigator, add shouldShowBetterNavigator() method 2019-07-10 12:56:10 +12:00
.editorconfig Added standard .editorconfig file 2015-12-18 07:15:21 +13:00
composer.json NEW: Auto-injection into template 2019-06-28 15:54:40 +12:00
config.rb PSR-2 conversion 2015-12-17 15:58:50 -08:00
README.md README updates 2019-07-10 13:18:47 +12:00

BetterNavigator for SilverStripe

Diagram of module

This module is intended to replicate and expand upon the functionality provided by SilverStripe's built-in SilverStripeNavigator class. It provides a handy front-end menu for CMS users which offers these features:

For Content Authors

  • Indicates to a user that they are logged in
  • Indicates whether they are viewing draft or live content
  • Quickly edit the page you're viewing

For Developers

  • When in Dev Mode links are included for accessing most of SilverStripe's URL Variable Tools
  • Developers can access these tools on a live website by nominating themselves as a developer in the site config

Requirements

SilverStripe 4.2 (3.1+ through previous releases)

Installation

Composer / Packagist (best practice) Add "jonom/silverstripe-betternavigator" to your requirements.

Manually Download, place the folder in your project root, rename it to 'betternavigator' (if applicable) and run a dev/build?flush=1.

How to use

The navigator is auto-injected into your template, and no code changes are needed.

If your website uses caching, make sure BetterNavigator's output is excluded.

Disabling the navigator

You can disable the navigator using your own custom logic by defining a showBetterNavigator(): bool method in any controller with the extension applied.

public function showBetterNavigator(): bool
{
    // A user-defined setting
    return $this->ShowDebugTools;
}

Access developer tools on a live website You can mark certain CMS users as developers in your site's config, so they can access developer tools when logged in. Example YAML:

  BetterNavigator:
    developers:
      - 'dev@yoursite.com'
      - 'otherdev@yoursite.com'

Customisation

BetterNavigator's output is controlled by templates so it can be [easily overridden](http://doc.silverstripe.org/framework/en/topics/theme-development# overriding).

Option 1: Add some stuff

If you want to add some content (new buttons for instance) to BetterNavigator, just create a template called BetterNavigatorExtraContent.ss or BetterNavigatorExtraDevTools.ss and add your content to it. Place the template in the includes folder for your website's theme, or in mysite/templates/includes/ if you want to use it across multiple themes.

Option 2: Complete control

All content, scripts and CSS are loaded via the BetterNavigator.ss template, so you can completely customise BetterNavigator's front-end code by copying or creating your own BetterNavigator.ss template.

The BetterNavigator.ss template's scope is set to the page that is being viewed, so any methods available in your page controller will be available in the BetterNavigator.ss template. This should allow you to add custom links by page type and introduce complex logic if you want to.

Known issues

  • Probably won't work in IE8 or lower.

Bonus: better debugging tools

This module provide quick access to SilverStripe's built in URL Variable Tools but reading their output isn't much fun. You can peek under SilverStripe's hood much more conveniently using the recently released SilverStripe Clockwork by Mark Guinn. Out of the box SQL Queries and controller events are logged. It's Chrome only for now.