Commit f446ae03 by semenov

1

parent d571deda
......@@ -36,7 +36,7 @@ class Form extends Core
return array_merge(parent::behaviors(), [
[
"class" => Serialize::className(),
'fields' => ['emails', 'phones']
'fields' => ['emails', 'phones', 'elements']
],
]);
}
......@@ -49,7 +49,7 @@ class Form extends Core
return array_merge(parent::rules(), [
[['name'], 'required'],
[['name', 'description'], 'string'],
[['emails', 'phones'], 'safe'],
[['emails', 'phones', 'elements'], 'safe'],
]);
}
......@@ -57,8 +57,8 @@ class Form extends Core
{
$scenarios = parent::scenarios();
$scenarios['create'] = ['name', 'description', 'emails', 'phones'];
$scenarios['update'] = ['name', 'description', 'emails', 'phones'];
$scenarios['create'] = $scenarios[self::SCENARIO_DEFAULT];
$scenarios['update'] = $scenarios[self::SCENARIO_DEFAULT];
return $scenarios;
}
......@@ -75,4 +75,5 @@ class Form extends Core
]);
}
}
\ No newline at end of file
<?php
/**
* LoginForm
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 28.10.2014
* @since 1.0.0
*/
namespace skeeks\modules\cms\form\models;
use Yii;
use yii\base\Model;
/**
* Login form
*/
class FormElement extends Model
{
public $label;
public $attribute;
/**
* @inheritdoc
*/
public function rules()
{
return [
// username and password are both required
[['attribute', 'label'], 'string'],
];
}
}
<?php
/**
* LoginForm
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 28.10.2014
* @since 1.0.0
*/
namespace skeeks\modules\cms\form\models;
use Yii;
use yii\base\Model;
/**
* Login form
*/
class FormEmail extends Model
{
public $value;
/**
* @inheritdoc
*/
public function rules()
{
return [
// username and password are both required
[['value'], 'required'],
// rememberMe must be a boolean value
['value', 'email'],
];
}
}
<?php
use yii\helpers\Html;
use skeeks\cms\modules\admin\widgets\form\ActiveFormStyled as ActiveForm;
use skeeks\cms\models\Tree;
use skeeks\cms\modules\admin\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $model Tree */
?>
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>
<?= $form->buttonsCreateOrUpdate($model); ?>
<?php ActiveForm::end(); ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment