/** * Registers menus when big triggers a search. * See [[bigbrush\big\core\Big::search()]] for more information about the search process. * * @param SearchEvent $event the event being triggered */ public function onSearch($event) { $depthAttribute = $this->getDatabaseColumnName('depth'); foreach ($this->getMenus(true) as $root) { foreach ($this->getItems($root->id) as $menu) { if (!empty($event->value) && strpos($menu->title, $event->value) === false) { continue; } if ($menu->lft != 1) { $event->addItem(['title' => str_repeat('- ', $menu->{$depthAttribute} - 1) . $menu->title, 'route' => $menu->route, 'text' => '', 'date' => '', 'section' => Yii::t('big', 'Menus')]); } } } }