getUri() публичный Метод

Return the menu entry's URI relative to Bolt admin's.
public getUri ( ) : string
Результат string
Пример #1
0
 /**
  * Return the menu entry's URI relative to Bolt admin's.
  *
  * @return string
  */
 public function getUri()
 {
     if (strpos($this->uri, '/') === 0) {
         return $this->uri;
     }
     return $this->parent ? $this->parent->getUri() . '/' . $this->uri : $this->uri;
 }
Пример #2
0
 /**
  * Configuration menus.
  *
  * @param Application $app
  */
 protected function addConfiguration(Application $app)
 {
     // Main configuration
     $configEntry = $this->rootEntry->add((new MenuEntry('config', 'config'))->setLabel(Trans::__('Configuration'))->setIcon('fa:cogs')->setPermission('settings'));
     // Users & Permssions
     $path = $this->rootEntry->getUri() . '/users';
     $configEntry->add((new MenuEntry('users', $path))->setLabel(Trans::__('Users & Permissions'))->setIcon('fa:group')->setPermission('users'));
     // Main configuration
     $path = $app['url_generator']->generate('fileedit', ['namespace' => 'config', 'file' => 'config.yml']);
     $configEntry->add((new MenuEntry('config_main', $path))->setLabel(Trans::__('Main configuration'))->setIcon('fa:cog')->setPermission('files:config'));
     // ContentTypes
     $path = $app['url_generator']->generate('fileedit', ['namespace' => 'config', 'file' => 'contenttypes.yml']);
     $configEntry->add((new MenuEntry('config_contenttypes', $path))->setLabel(Trans::__('Contenttypes'))->setIcon('fa:paint-brush')->setPermission('files:config'));
     // Taxonomy
     $path = $app['url_generator']->generate('fileedit', ['namespace' => 'config', 'file' => 'taxonomy.yml']);
     $configEntry->add((new MenuEntry('config_taxonomy', $path))->setLabel(Trans::__('Taxonomy'))->setIcon('fa:tags')->setPermission('files:config'));
     // Menus
     $path = $app['url_generator']->generate('fileedit', ['namespace' => 'config', 'file' => 'menu.yml']);
     $configEntry->add((new MenuEntry('config_menu', $path))->setLabel(Trans::__('Menu setup'))->setIcon('fa:list')->setPermission('files:config'));
     // Routing
     $path = $app['url_generator']->generate('fileedit', ['namespace' => 'config', 'file' => 'routing.yml']);
     $configEntry->add((new MenuEntry('config_routing', $path))->setLabel(Trans::__('menu.configuration.routing'))->setIcon('fa:random')->setPermission('files:config'));
     // Database checks
     $path = $this->rootEntry->getUri() . '/dbcheck';
     $configEntry->add((new MenuEntry('dbcheck', $path))->setLabel(Trans::__('Check database'))->setIcon('fa:database')->setPermission('dbupdate'));
     // Cache flush
     $path = $this->rootEntry->getUri() . '/clearcache';
     $configEntry->add((new MenuEntry('clearcache', $path))->setLabel(Trans::__('Clear the cache'))->setIcon('fa:eraser')->setPermission('clearcache'));
     // Change log
     $path = $this->rootEntry->getUri() . '/changelog';
     $configEntry->add((new MenuEntry('log_change', $path))->setLabel(Trans::__('logs.change-log'))->setIcon('fa:archive')->setPermission('changelog'));
     // System log
     $path = $this->rootEntry->getUri() . '/systemlog';
     $configEntry->add((new MenuEntry('log_system', $path))->setLabel(Trans::__('logs.system-log'))->setIcon('fa:archive')->setPermission('systemlog'));
 }
Пример #3
0
 public function testCreateRoot()
 {
     $app = $this->getApp();
     $rootEntry = new MenuEntry('root', $app['config']->get('general/branding/path'));
     $this->assertInstanceOf('Bolt\\Menu\\MenuEntry', $rootEntry);
     $this->assertSame('/bolt', $rootEntry->getUri());
     $this->assertSame('root', $rootEntry->getName());
     $this->assertNull($rootEntry->getIcon());
     $this->assertSame('everyone', $rootEntry->getPermission());
     $app['config']->set('general/branding/path', '/koala/drop-bear');
     $rootEntry = new MenuEntry('root', $app['config']->get('general/branding/path'));
     $this->assertSame('/koala/drop-bear', $rootEntry->getUri());
 }