PHP Classes

File: views/backend/page/_list.php

Recommend this page to a friend!
  Classes of Gabriel Alejandro López López   Yii2 Website Module   views/backend/page/_list.php   Download  
File: views/backend/page/_list.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Yii2 Website Module
Add a content page management system to a site
Author: By
Last change:
Date: 1 month ago
Size: 1,646 bytes
 

Contents

Class file image Download
<?php

use yii\widgets\ListView;
use
yii\helpers\Html;
use
yii\helpers\Url;
use
yii\web\View;

$newItem = [
   
'title' => Yii::t('website', 'New Page'),
   
'image' => Yii::$app->thumbnailer->get(Yii::getAlias('@web/images/no-image.png'), 75),
];

$language = isset($language) ? $language : $parent->language;
$parent = isset($parent) ? $parent : null;

?>
<div class="dropdown mb-3">
    <?= Html::a(Yii::t('app', 'Create') . Html::tag('b', false, ['class' => 'caret']), '#types-dropdown', [
       
'class' => 'btn btn-primary dropdown-toggle',
       
'data-toggle' => 'dropdown',
    ])
?>
<?= \yii\bootstrap4\Dropdown::widget([
       
'items' => array_map(function ($item) use ($language, $parent) {
            return [
               
'label' => strtoupper(Html::encode($item->name)),
               
'url' => ['page/create',
                   
'page_type_id' => $item->id,
                   
'language' => $language,
                   
'parent_id' => isset($parent) ? $parent->id : null
               
],
            ];
        },
Yii::$app->website->pageTypes)
    ])
?>
</div>

<?= ListView::widget([
   
'dataProvider' => $dataProvider,
   
'layout' => Html::tag('ol', '{items}', [
           
'class' => 'list-unstyled',
           
'data-update-page' => Url::toRoute(['page/update-position'])
        ]) .
"\n{pager}",
   
'itemView' => '_view',
   
'itemOptions' => ['tag' => false],
   
'pager' => [
       
'class' => 'yii\bootstrap4\LinkPager',
    ]
])
?>

<?php
// register components as protected elements in ckeditor
$script = <<< JS

       
JS;

$this->registerJs($script, View::POS_END);
?>