2017 © Pedro Peláez
 

cakephp-plugin cakeadmin-adminbar

AdminBar plugin for CakeAdmin and CakePHP

image

cakemanager/cakeadmin-adminbar

AdminBar plugin for CakeAdmin and CakePHP

  • Thursday, July 16, 2015
  • by bobmulder
  • Repository
  • 2 Watchers
  • 0 Stars
  • 35 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 9 % Grown

The README.md

AdminBar plugin for CakeAdmin and CakePHP

This plugin generates an easy-to-use admin-bar on top of your application when you are logged in as administrator., (*1)

Note: This is a non-stable plugin for CakePHP 3.x at this time. It is currently under development and should be considered experimental., (*2)

Installation

You can install this plugin into your CakePHP application using composer., (*3)

The recommended way to install composer packages is:, (*4)

composer require cakemanager/cakeadmin-adminbar:dev-master

Now load the plugin with the command:, (*5)

$ bin/cake plugin load -r -b AdminBar

The last thing you need to do is to load the AdminBar.AdminBar-Component using:, (*6)

$this->loadComponent('AdminBar.AdminBar');

Settings

You can activate or deactivate the AdminBar in the settings-page in the backend., (*7)

Adding new items

Adding items is done via the Configure-class of CakePHP. Look at this example:, (*8)

Configure::write('AdminBar.goto_backend', [
    'on' => [
        'prefix' => ['!admin', '*'],
        'controller' => '*',
        'action' => '*',
    ],
    'label' => 'CakeAdmin Panel',
    'url' => '/admin'
]);

Explanation: - goto_backend - The name of the item. Should be unique (because of overriding in the Configure-class). - on - The on-key is used to validate if the item should be shown looking at the current request. See docs below. - label - A string wich is the label of your item. - url - A string or array to create the url. For all available options, see docs below., (*9)

On-key

Via the on-key you can validate if the item should be shown., (*10)

  • When using a ! before the used key (like 'prefix' => '!admin'), the current prefix should NOT be admin.
  • When using a name (like 'prefix' => 'admin') the current prefix has to be equal to admin.
  • When using * (like 'prefix' => '*') the current prefix can be anything.
  • When you want to validate on multiple names you should use an array like 'prefix' => ['!admin', '*'],

You can validate on plugin, prefix, controller, action and any other parameter you want to validate on. So this means when you defined a parameter type in your routes, you can validate on type by using:, (*11)

Configure::write('AdminBar.custom_type', [
    'on' => [
        'controller' => '*',
        'action' => '*',
        'type' => 'specific'
    ],
]);

Url-key

The url-key can be an string, or array to create an url. You can get parameters of the request using ::, (*12)

Configure::write('AdminBar.read_blog', [
    'label' => 'Read Blog',
    'url' => [
        'prefix' => false,
        'plugin' => 'Cms',
        'controller' => 'Blogs',
        'action' => 'view',
        ':pass.1'
    ]
]);

The :pass.1 is used to get a specific value of the request-parameters. When these are nested, use a . to go into them. Looking back on our type-example, you could use this:, (*13)

Configure::write('AdminBar.custom_type', [
    'url' => [
        'prefix' => false,
        'plugin' => 'Cms',
        'controller' => 'Blogs',
        'action' => 'view',
        ':type'
    ]
]);

Keep in touch

If you need some help or got ideas for this plugin, feel free to chat at Gitter., (*14)

Pull Requests are always more than welcome!, (*15)

The Versions

16/07 2015

dev-master

9999999-dev

AdminBar plugin for CakeAdmin and CakePHP

  Sources   Download

The Requires

 

The Development Requires