PHP code example of teppokoivula / admin-bar

1. Go to this page and download the library: Download teppokoivula/admin-bar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

teppokoivula / admin-bar example snippets


$wire->addHookAfter('AdminBar::getItems', function(HookEvent $event) {
    $items = $event->return;

    // Using an icon name (resolved via getIcon method)
    $items['right']['events'] = [
        'class' => 'events',
        'link' => '/admin/page/?id=1234',
        'text' => 'Events',
        'icon' => 'calendar',
    ];

    // Using raw SVG markup
    $items['right']['custom'] = [
        'class' => 'custom',
        'link' => '/custom/',
        'text' => 'Custom',
        'icon' => '<svg class="adminbar__icon" ...>...</svg>',
    ];

    $event->return = $items;
});

$adminBar = $modules->get('AdminBar');
if ($adminBar->isEnabled()) {
    $html = str_ireplace(
        '</body>',
        $adminBar->renderWithAssets(['page' => $page]) . '</body>',
        $html
    );
}

$adminBar->renderWithAssets(['page' => null])