Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yii2-widgets2-module
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
hrzg
yii2-widgets2-module
Commits
ce1ee30b
Commit
ce1ee30b
authored
Jul 19, 2016
by
Tobias Munk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
⚠
renamed widget WidgetContainer to Cell
parent
b2165f30
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
6 deletions
+26
-6
README.md
README.md
+8
-0
WidgetContent.php
src/models/crud/WidgetContent.php
+10
-0
Cell.php
src/widgets/Cell.php
+8
-6
No files found.
README.md
View file @
ce1ee30b
...
...
@@ -103,3 +103,11 @@ Example with `yii2-prototype-module`
```
For more examples, please see the
[
docs
](
./docs
)
Upgrading
---------
### from 0.2 to 0.3
{{ cell_widget({id: 'header'}) }}
\ No newline at end of file
src/models/crud/WidgetContent.php
View file @
ce1ee30b
...
...
@@ -10,6 +10,16 @@ use yii\helpers\ArrayHelper;
*/
class
WidgetContent
extends
BaseWidget
{
public
function
rules
()
{
return
ArrayHelper
::
merge
(
parent
::
rules
(),
[
[
'name_id'
,
'match'
,
'pattern'
=>
'/^[a-z0-9-]*$/i'
]
]
);
}
public
static
function
optsWidgetTemplateId
()
{
return
ArrayHelper
::
merge
(
...
...
src/widgets/
WidgetContainer
.php
→
src/widgets/
Cell
.php
View file @
ce1ee30b
...
...
@@ -19,10 +19,12 @@ use yii\helpers\Html;
use
yii\helpers\Json
;
use
yii\helpers\Url
;
class
WidgetContainer
extends
Widget
class
Cell
extends
Widget
{
const
CSS_PREFIX
=
'hrzg-widget'
;
public
$requestParam
=
'pageId'
;
public
function
init
()
{
\Yii
::
$app
->
trigger
(
'registerMenuItems'
,
new
Event
([
'sender'
=>
$this
]));
...
...
@@ -49,7 +51,7 @@ class WidgetContainer extends Widget
'WidgetContent'
=>
[
'route'
=>
$this
->
getRoute
(),
'container_id'
=>
$this
->
id
,
'request_param'
=>
\Yii
::
$app
->
request
->
get
(
'id'
),
'request_param'
=>
\Yii
::
$app
->
request
->
get
(
$this
->
requestParam
),
'access_domain'
=>
\Yii
::
$app
->
language
,
],
],
...
...
@@ -76,13 +78,13 @@ class WidgetContainer extends Widget
->
orderBy
(
'rank ASC'
)
->
andFilterWhere
(
[
'request_param'
=>
\Yii
::
$app
->
request
->
get
(
'id'
),
'request_param'
=>
\Yii
::
$app
->
request
->
get
(
$this
->
requestParam
),
]
)
->
andWhere
(
[
'container_id'
=>
$this
->
id
,
'route'
=>
$this
->
getRoute
()
,
'route'
=>
[
$this
->
getRoute
(),
'*'
]
,
'access_domain'
=>
\Yii
::
$app
->
language
,
])
->
all
();
...
...
@@ -139,7 +141,7 @@ class WidgetContainer extends Widget
'WidgetContent'
=>
[
'route'
=>
$this
->
getRoute
(),
'container_id'
=>
$this
->
id
,
'request_param'
=>
\Yii
::
$app
->
request
->
get
(
'id'
),
'request_param'
=>
\Yii
::
$app
->
request
->
get
(
$this
->
requestParam
),
'access_domain'
=>
\Yii
::
$app
->
language
,
]
],
...
...
@@ -152,7 +154,7 @@ class WidgetContainer extends Widget
{
$html
=
Html
::
beginTag
(
'div'
,
[
'class'
=>
'hrzg-widget-widget-controls btn-group'
,
'role'
=>
'group'
]);
$html
.=
Html
::
a
(
FA
::
icon
(
FA
::
_PENCIL
)
.
' #'
.
$widget
->
id
.
' '
.
$widget
->
template
->
name
.
' <span class="label label-default">'
.
$widget
->
rank
.
'</span>'
,
FA
::
icon
(
FA
::
_PENCIL
)
.
' #'
.
$widget
->
id
.
' '
.
$widget
->
name_id
.
' '
.
$widget
->
template
->
name
.
' <span class="label label-default">'
.
$widget
->
rank
.
'</span>'
,
[
'/widgets/crud/widget/update'
,
'id'
=>
$widget
->
id
],
[
'class'
=>
'btn btn-xs btn-primary'
]
);
...
...
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