Exemplo n.º 1
0
 public function save($validation = false, $attributes = [])
 {
     SettingsRecord::deleteAll(['categoryAlias' => $this->category]);
     foreach ($this->fields() as $key) {
         $model = new SettingsRecord();
         $model->categoryAlias = $this->category;
         $model->alias = $key;
         $model->content = $this->{$key};
         $model->save();
     }
     return true;
 }
Exemplo n.º 2
0
 public function summary()
 {
     return [['property' => 'og:type', 'content' => SettingsRecord::get($this->category, 'type')], ['property' => 'profile:first_name', 'content' => SettingsRecord::get($this->category, 'first_name')], ['property' => 'profile:last_name', 'content' => SettingsRecord::get($this->category, 'last_name')], ['property' => 'og:title', 'content' => SettingsRecord::get($this->category, 'title')], ['property' => 'og:description', 'content' => SettingsRecord::get($this->category, 'description')], ['property' => 'og:url', 'content' => SettingsRecord::get($this->category, 'url')], ['property' => 'og:site_name', 'content' => SettingsRecord::get($this->category, 'site_name')], ['property' => 'og:see_also', 'content' => SettingsRecord::get($this->category, 'see_also')], ['property' => 'fb:admins', 'content' => SettingsRecord::get($this->category, 'admins')]];
 }
Exemplo n.º 3
0
        <div class="panel panel-default">
            <div class="panel-heading"><?php 
    echo $model->classTitle;
    ?>
</div>
            <div class="panel-body">
                <?php 
    $form = ActiveForm::begin(['action' => ['index', 'className' => $model->className()]]);
    ?>

                <?php 
    foreach ($model->fields() as $k) {
        ?>
                    <?php 
        echo $form->field($model, $k)->textInput(['value' => Settings::get($model->category, $k)]);
        ?>
                <?php 
    }
    ?>
                <?php 
    echo \yii\bootstrap\Html::submitButton('Сохранить', ['class' => 'btn btn-success']);
    ?>
                <?php 
    ActiveForm::end();
    ?>
            </div>
        </div>
    </div>
    <?php 
}