altamash80 / dynamic-bootstrap-menu-laminasmvc-doctrine
Create dynamic menus via doctrine in Laminas MVC.
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Language:JavaScript
Requires
- php: ^7.3 || ^8.0
- doctrine/doctrine-bundle: ^2.2
- doctrine/migrations: ^3.0.0
- doctrine/persistence: ^2.1
- gedmo/doctrine-extensions: ^3.0
This package is auto-updated.
Last update: 2024-08-10 11:08:39 UTC
README
Create dynamic menus via doctrine in Laminas MVC.
Installation without LmcRbacMvc
composer require altamash80/laminas-mvc-bootstrap-menu:"1.0.0"
composer require altamash80/dynamic-bootstrap-menu-laminasmvc-doctrine
Installation with LmcRbacMvc
composer require altamash80/laminas-mvc-bootstrap-menu:"1.1.0"
composer require altamash80/dynamic-bootstrap-menu-laminasmvc-doctrine
Dependency
- Doctrine
- Navigation
- Lrphpt Menu
- Laminas MVC(minimum)
Add Module in module config file
Add the module name in module.config.php.
return[
'Laminas\Navigation',
'Lrphpt',
'LRPHPT\MenuTree',
'Application',
];
Run the command line below to create and execute migration. To set up migration check this link.
./vendor/bin/doctrine-module migrations:diff
./vendor/bin/doctrine-module migrations:execute
Mandatory check
- Copy the pickletree javscript folder and paste it in public folder.
- Make sure you've echo $this->inlineScript() in your layout.phtml file or any layout file you're using.
Access in browser
yourhost/lrphpt-menu
Create a root menu for access as shown below.
After creating the root menu, start building the actual menu items as shown in the image below.
Usage
Add the below line in any layout.phtml file.
<?=$this->navigation('lrphpt_navigation')
->bootstrapMenu()
->setUlClass('navbar-nav')
// Optional setting to use with LmcRbac route guard.
//->setAuthorizationService($this->LmcRbacAuthorizationServiceHelper())
; ?>
Use the below configuration first by creating a navigation factory with someother_navigation. See this link. Then write the below lines in the class file.
public function getName(){
return 'footer-menu';
}
<?=$this->navigation('someother_navigation')
->bootstrapMenu()
->setUlClass('navbar-nav')
// Optional setting to use with LmcRbac route guard.
//->setAuthorizationService($this->LmcRbacAuthorizationServiceHelper())
; ?>