Page Sidebar Navigation

The “sidebar navigation” shown on the left normally shows the a link to the Crud index action for all tables. You can customize it using the scaffold.sidebar_navigation configuration key.

Specifying which tables to show

You can specify the exact tables to show in the sidebar via the scaffold.tables configuration key:

// only show the posts table
$this->Crud->action()->setConfig('scaffold.tables', ['posts']);

Blacklisting tables

As an alternative to whitelisting tables via scaffold.tables, you can use the scaffold.tables_blacklist configuration key to specify tables to exclude from the output:

// do not show the ``phinxlog`` and ``users`` tables
$this->Crud->action()->setConfig('scaffold.tables_blacklist', [
    'phinxlog',
    'users',
]);

You can also specify a global tables blacklist by setting CrudView.tablesBlacklist configuration key. By default the phinxlog table is blacklisted.

Configure::write('CrudView.tablesBlacklist', ['phinxlog']);

Disabling the Sidebar Navigation

The sidebar navigation can also be completely disabled by setting the value to false.

$this->Crud->action()->setConfig('scaffold.sidebar_navigation', false);

Custom Menus

The sidebar navigation is just like any other menu in the system. You can provide your own menu to be rendered in its place:

use CrudView\Menu\MenuDivider;
use CrudView\Menu\MenuItem;

$this->Crud->action()->setConfig('scaffold.sidebar_navigation', [
    new MenuItem('Section Header'),
    new MenuItem(
        'CrudView Docs',
        'https://crud-view.readthedocs.io/en/latest/contents.html',
        ['target' => 'blank']
    ),
    new MenuItem(
        'Profile',
        ['controller' => 'Users', 'action' => 'profile']
    ),
    new MenuItem(
        'Inbox',
        ['controller' => 'Users', 'action' => 'inbox']
    ),
    new MenuItem(
        'Settings',
        ['controller' => 'Site', 'action' => 'settings']
    ),
    new MenuDivider(),
    new MenuItem(
        'Log Out',
        ['controller' => 'Users', 'action' => 'logout']
    )
]);
  v: stable
Versions
latest
stable
docs
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds
Downloads
On GitHub
View
Edit

Free document hosting provided by Read the Docs.