PHP code example of drago-ex / project-backend-ui

1. Go to this page and download the library: Download drago-ex/project-backend-ui 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/ */

    

drago-ex / project-backend-ui example snippets


private function getSidebarMenuStructure(): array
{
	$builder = new SidebarBuilder;

	// Sections are optional and serve as titles/separators
	$builder->addSection('System')
		// Simple link with icon
		->addItem('Dashboard', 'Admin:')
		->setIcon('fa-solid fa-mug-hot bell')

		// Complex item with permissions and submenu
		->addItem('Permissions', 'AccessControl:*')
		->setIcon('fa-solid fa-gear bell')
		->setAllowAny('Backend:AccessControl', 'roles-read', 'users-read')
		->addSubItem('Roles', 'AccessControl:roles', ['Backend:AccessControl', 'roles-read'])
		->addSubItem('Users', 'AccessControl:users', ['Backend:AccessControl', 'users-read']);

	return $builder->build();
}

protected function beforeRender(): void
{
	parent::beforeRender();
	$this->template->sidebarMenu = $this->getSidebarMenuStructure();
}