Esempio n. 1
0
 /**
  * @return Widget
  */
 public function getWidget()
 {
     return CMSBlock::getManager()->getWidget($this->id);
 }
Esempio n. 2
0
 public function __construct(LinkManager $linkManager)
 {
     $this->linkManager = $linkManager;
     parent::__construct();
 }
Esempio n. 3
0
<?php

use nullref\cms\components\Block as CMSBlock;
use nullref\cms\blocks\EmptyBlock;
/** @var $this \yii\web\View */
/** @var $page \nullref\cms\models\Page */
$this->title = $page->title;
$page->registerMetaTags($this);
foreach ($page->items as $item) {
    ?>
    <?php 
    if ($item->block) {
        ?>
        <?php 
        echo CMSBlock::getManager()->getWidget($item->block_id);
        ?>
    <?php 
    } else {
        ?>
        <?php 
        echo EmptyBlock::widget(['id' => $item->block_id]);
        ?>
    <?php 
    }
}
?>

Esempio n. 4
0
?>

    <div class="row">
        <div class="col-md-6">
            <?php 
if ($model->isNewRecord) {
    ?>
                <?php 
    echo $form->field($model, 'id')->textInput(['maxlength' => true]);
    ?>
            <?php 
}
?>

            <?php 
echo $form->field($model, 'class_name')->dropDownList(CMSBlock::getManager()->getDropDownArray(), ['prompt' => '']);
?>
        </div>
        <div class="col-md-6">
            <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

            <?php 
echo $form->field($model, 'visibility')->dropDownList(Block::getVisibilityList());
?>
        </div>
    </div>

    <div class="form-group">
        <?php 
Esempio n. 5
0
 public function canGetProperty($name, $checkVars = true, $checkBehaviors = true)
 {
     foreach ($this->_languagesMap as $key => $languages) {
         if (substr($name, -3) === '_' . $key) {
             $attr = substr($name, 0, count($name) - 4);
             return property_exists($this, $attr);
         }
     }
     return parent::canGetProperty($name, $checkVars, $checkBehaviors);
 }
Esempio n. 6
0
if (Yii::$app->session->hasFlash('delete-is-not-allowed')) {
    ?>
        <div class="alert alert-danger">
            <?php 
    echo Yii::$app->session->getFlash('delete-is-not-allowed');
    ?>
        </div>
    <?php 
}
?>

    <p>
        <?php 
echo Html::a(Yii::t('cms', 'Create Block'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'name', ['filter' => BlockComponent::getManager()->getDropDownArray(), 'attribute' => 'class_name', 'value' => 'typeName'], ['attribute' => 'created_at', 'format' => 'datetime', 'filter' => false], ['attribute' => 'updated_at', 'format' => 'datetime', 'filter' => false], ['attribute' => 'pages', 'format' => 'html', 'value' => function (Block $model) {
    $names = \yii\helpers\ArrayHelper::getColumn($model->pages, function (Page $page) {
        return Html::a($page->title, ['/cms/admin/page/update', 'id' => $page->id], ['class' => 'label label-primary']);
    });
    return implode(' ', $names);
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update} {config} {delete}', 'buttons' => ['config' => function ($url, Block $model, $key) {
    $options = ['title' => Yii::t('cms', 'Config'), 'aria-label' => Yii::t('cms', 'Config'), 'data-pjax' => '0'];
    return Html::a('<span class="glyphicon glyphicon-cog"></span>', $url, $options);
}]]]]);
?>

</div>