Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
skeeks
/
cms-module-form
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Merge Requests
0
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f446ae03
authored
Mar 12, 2015
by
semenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
d571deda
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
103 additions
and
4 deletions
+103
-4
models/Form.php
+6
-4
models/FormElement.php
+38
-0
models/FormEmail.php
+38
-0
views/admin-form/_form.php
+21
-0
No files found.
models/Form.php
View file @
f446ae03
...
...
@@ -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
models/FormElement.php
View file @
f446ae03
<?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'
],
];
}
}
models/FormEmail.php
0 → 100644
View file @
f446ae03
<?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'
],
];
}
}
views/admin-form/_form.php
0 → 100644
View file @
f446ae03
<?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
();
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment