silverstripe-betternavigator/README.md

83 lines
3.7 KiB
Markdown
Raw Normal View History

2017-03-23 00:39:21 +01:00
# BetterNavigator for SilverStripe
2014-08-13 03:56:47 +02:00
2014-11-06 07:25:59 +01:00
![Diagram of module](images/demo.png)
2014-08-12 12:15:23 +02:00
2014-08-13 02:41:18 +02:00
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**
2014-08-13 02:46:27 +02:00
* 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
2015-12-18 00:58:50 +01:00
2014-08-13 02:47:51 +02:00
**For Developers**
2015-12-18 00:58:50 +01:00
2014-08-13 02:46:27 +02:00
* When in Dev Mode links are included for accessing most of SilverStripe's [URL Variable Tools](http://doc.silverstripe.org/framework/en/reference/urlvariabletools)
* Developers can access these tools on a live website by nominating themselves as a developer in the site config
2014-08-13 02:41:18 +02:00
2017-03-23 00:39:21 +01:00
## Requirements
2014-08-13 02:41:18 +02:00
SilverStripe 4.0 (3.1+ through previous releases)
2014-08-13 02:41:18 +02:00
2017-03-23 00:39:21 +01:00
## Installation
2014-08-13 02:41:18 +02:00
2015-12-18 00:58:50 +01:00
**Composer / Packagist ([best practice](http://doc.silverstripe.org/framework/en/trunk/installation/composer))**
2014-08-13 02:41:18 +02:00
Add "jonom/silverstripe-betternavigator" to your requirements.
2015-12-18 00:58:50 +01:00
**Manually**
2014-08-13 02:41:18 +02:00
Download, place the folder in your project root, rename it to 'betternavigator' (if applicable) and run a dev/build?flush=1.
2017-03-23 00:39:21 +01:00
## How to use
2014-08-13 02:41:18 +02:00
The navigator is auto-injected into your template, and no code changes are needed.
2014-08-13 02:41:18 +02:00
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.
```php
public function showBetterNavigator()
{
// A user-defined setting
return $this->ShowDebugTools;
}
```
2015-12-18 00:58:50 +01:00
**Access developer tools on a live website**
2014-11-06 07:25:59 +01:00
You can mark certain CMS users as developers in your site's config, so they can access developer tools when logged in. Example YAML:
2014-08-13 02:54:13 +02:00
```
BetterNavigator:
developers:
- 'dev@yoursite.com'
- 'otherdev@yoursite.com'
```
2017-03-23 00:39:21 +01:00
## Customisation
2014-08-13 02:41:18 +02:00
BetterNavigator's output is controlled by templates so it can be [easily overridden](http://doc.silverstripe.org/framework/en/topics/theme-development#overriding).
2014-08-13 02:41:18 +02:00
Some empty `<% include %>` placeholders are included to let you easily add more content (new buttons for instance). Just create any of these templates in your theme or app directory and add your content:
2014-11-06 07:25:59 +01:00
* *templates/JonoM/BetterNavigator/Includes/* BetterNavigatorExtraContent.ss
* *templates/JonoM/BetterNavigator/Includes/* BetterNavigatorExtraDebugging.ss
* *templates/JonoM/BetterNavigator/Includes/* BetterNavigatorExtraDevTools.ss
2014-11-06 07:25:59 +01:00
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.
2014-08-13 02:41:18 +02:00
2017-03-23 00:39:21 +01:00
## Bonus: better debugging tools
2014-11-21 23:56:02 +01:00
This module provide quick access to SilverStripe's built in [URL Variable Tools](http://doc.silverstripe.org/framework/en/reference/urlvariabletools) but reading their output isn't much fun. You can peek under SilverStripe's hood much more conveniently using lekoala's [SilverStripe DebugBar](https://github.com/lekoala/silverstripe-debugbar)
2020-05-27 19:02:22 +02:00
## Maintainer contact
[Jono Menz](https://jonomenz.com)
## Sponsorship
If you want to boost morale of the maintainer you're welcome to make a small monthly donation through [**GitHub**](https://github.com/sponsors/jonom), or a one time donation through [**PayPal**](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z5HEZREZSKA6A). ❤️ Thank you!
Please also feel free to [get in touch](https://jonomenz.com) if you want to hire the maintainer to develop a new feature, or discuss another opportunity.