mirror of
https://github.com/jonom/silverstripe-betternavigator.git
synced 2024-10-22 14:05:51 +02:00
add namespace to config, fixes #63
This commit is contained in:
parent
f9304b3441
commit
5e99263c33
13
README.md
13
README.md
@ -21,16 +21,12 @@ Silverstripe 5.0 (4.0+ and 3.1+ through previous releases)
|
||||
|
||||
## Installation
|
||||
|
||||
**Composer / Packagist ([best practice](http://doc.silverstripe.org/framework/en/trunk/installation/composer))**
|
||||
Add "jonom/silverstripe-betternavigator" to your requirements.
|
||||
Add "jonom/silverstripe-betternavigator" to your composer requirements.
|
||||
|
||||
```
|
||||
composer require jonom/silverstripe-betternavigator
|
||||
```
|
||||
|
||||
**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.
|
||||
@ -53,7 +49,7 @@ public function showBetterNavigator()
|
||||
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:
|
||||
JonoM\BetterNavigator:
|
||||
developers:
|
||||
- 'dev@yoursite.com'
|
||||
- 'otherdev@yoursite.com'
|
||||
@ -64,14 +60,14 @@ BetterNavigator:
|
||||
BetterNavigator can be made translucent when collapsed by adding the following config setting:
|
||||
|
||||
```
|
||||
BetterNavigator:
|
||||
JonoM\BetterNavigator:
|
||||
translucent: true
|
||||
```
|
||||
|
||||
BetterNavigator's default position is 'right-top', but can be changed to 'right-bottom', 'left-top' or 'left-bottom'. Example:
|
||||
|
||||
```
|
||||
BetterNavigator:
|
||||
JonoM\BetterNavigator:
|
||||
position: 'right-bottom'
|
||||
```
|
||||
|
||||
@ -113,6 +109,7 @@ By default users are required to have at least the `CMS_ACCESS_CMSMain` permissi
|
||||
My\Namespace\EventController:
|
||||
better_navigator_edit_permission: "CUSTOM_PERMISSION_CODE"
|
||||
better_navigator_edit_permission_mode: "any" #Optional, but can be either "any" or "all" (defaults to "all")
|
||||
```
|
||||
|
||||
## Bonus: better debugging tools
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
"silverstripe/framework": "^5"
|
||||
},
|
||||
"extra": {
|
||||
"installer-name": "betternavigator",
|
||||
"expose": [
|
||||
"css",
|
||||
"images",
|
||||
|
@ -129,7 +129,7 @@ class BetterNavigatorExtension extends DataExtension
|
||||
|
||||
// Is the logged in member nominated as a developer?
|
||||
$member = Security::getCurrentUser();
|
||||
$devs = Config::inst()->get('BetterNavigator', 'developers');
|
||||
$devs = Config::inst()->get('JonoM\BetterNavigator', 'developers');
|
||||
$identifierField = Member::config()->unique_identifier_field;
|
||||
$isDeveloper = $member && is_array($devs) ? in_array($member->{$identifierField}, $devs) : false;
|
||||
|
||||
@ -207,8 +207,8 @@ class BetterNavigatorExtension extends DataExtension
|
||||
private function BetterNavigatorCssClass() {
|
||||
$classes = '';
|
||||
|
||||
$position = Config::inst()->get('BetterNavigator', 'position');
|
||||
$translucent = Config::inst()->get('BetterNavigator', 'translucent');
|
||||
$position = Config::inst()->get('JonoM\BetterNavigator', 'position');
|
||||
$translucent = Config::inst()->get('JonoM\BetterNavigator', 'translucent');
|
||||
|
||||
if ($position === 'left-top' || $position === 'left-bottom' || $position === 'right-bottom') {
|
||||
$classes .= ' ' . $position;
|
||||
|
Loading…
Reference in New Issue
Block a user