/** * Registers page content when big performs a search. * See [[bigbrush\big\core\Big::search()]] for more information about the search process. * * @param bigbrush\big\core\SearchEvent $event the event being triggered */ public static function onSearch($event) { $query = Page::find()->select(['id', 'title', 'category_id', 'alias', 'intro_content', 'created_at'])->orderBy('title')->asArray(); // adjust query if $event->value is not empty. Then a search for a specific value is being made. if (!empty($event->value)) { $query->orWhere(['like', 'title', $event->value]); $query->orWhere(['like', 'content', $event->value]); } $items = $query->all(); foreach ($items as $item) { $event->addItem(['title' => $item['title'], 'route' => Route::page($item), 'text' => $item['intro_content'], 'date' => $item['created_at'], 'section' => Yii::t('cms', 'Pages')]); } // pages categories foreach (Yii::$app->big->categoryManager->getItems('pages') as $item) { // $event->value is a value being searched for. If set then only include the category when its title matches // the search string if (!empty($event->value) && strpos($item->title, $event->value) === false) { continue; } // match found so add it in the $event $event->addItem(['title' => str_repeat('- ', $item->depth - 1) . $item->title, 'route' => Route::category($item), 'text' => $item->content, 'date' => $item->created_at, 'section' => Yii::t('cms', 'Pages categories')]); } }
if ($block->showTitle) { ?> <h3><?php echo $block->title; ?> </h3> <?php } ?> <?php foreach ($pages as $page) { ?> <div class="page-list-item"> <?php echo Html::a($page['title'], Route::page($page, '/')); ?> <?php if (!empty($block->model->author_editor)) { ?> <div class="page-author"> <?php if (!empty($block->model->author_editor_text)) { ?> <span class="page-author-text"> <?php echo $block->model->author_editor_text; ?> </span>
*/ use yii\helpers\Html; use yii\bootstrap\ActiveForm; use yii\bootstrap\Tabs; use bigbrush\cms\modules\pages\components\Route; $type = Yii::t('cms', 'page'); $title = $model->id ? Yii::t('cms', 'Edit {0}', $type) : Yii::t('cms', 'Create {0}', $type); $this->title = $title; $toolbar = Yii::$app->toolbar; ?> <?php $form = ActiveForm::begin(); $toolbar->save()->saveStay()->back(); if (!$model->getIsNewRecord()) { $url = Yii::$app->getUrlManager()->createUrlFrontend(Route::page($model)); $toolbar->addButton(Html::a($toolbar->createText('eye', Yii::t('cms', 'Go to page')), $url, $toolbar->createButtonOptions(['target' => '_blank']))); } $items = [['label' => Yii::t('cms', 'Page'), 'content' => $this->render('_tab_page', ['model' => $model, 'form' => $form, 'categories' => $categories, 'templates' => $templates])], ['label' => Yii::t('cms', 'Publishing'), 'content' => $this->render('_tab_publishing', ['model' => $model, 'form' => $form])], ['label' => Yii::t('cms', 'Images'), 'content' => $this->render('_tab_images', ['model' => $model, 'form' => $form])], ['label' => Yii::t('cms', 'Seo'), 'content' => $this->render('_tab_seo', ['model' => $model, 'form' => $form])]]; if ($model->getIsNewRecord() === false) { $items[] = ['label' => Yii::t('cms', 'Info'), 'content' => $this->render('_tab_info', ['model' => $model, 'form' => $form])]; $title .= ' <span class="small">[ ' . $model->title . ' ]</span>'; } ?> <h1><?php echo $title; ?> </h1> <div class="row"> <div class="col-md-12">
<?php /** * @link http://www.bigbrush-agency.com/ * @copyright Copyright (c) 2015 Big Brush Agency ApS * @license http://www.bigbrush-agency.com/license/ */ use yii\helpers\Html; use bigbrush\cms\modules\pages\components\Route; $list = []; foreach ($pages as $page) { $list[] = Html::a($page['title'], Route::page($page, '/')); } echo Html::ul($list, ['encode' => false]);