Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
512a9bd1
Commit
512a9bd1
authored
May 22, 2013
by
Alexander Kochetov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clientOptions and clientEvents
parent
6ca204a0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
25 deletions
+25
-25
Alert.php
framework/yii/bootstrap/Alert.php
+4
-4
Modal.php
framework/yii/bootstrap/Modal.php
+7
-7
TypeAhead.php
framework/yii/bootstrap/TypeAhead.php
+4
-4
Widget.php
framework/yii/bootstrap/Widget.php
+10
-10
No files found.
framework/yii/bootstrap/Alert.php
View file @
512a9bd1
...
...
@@ -79,7 +79,7 @@ class Alert extends Widget
$this
->
initOptions
();
echo
Html
::
beginTag
(
'div'
,
$this
->
htmlO
ptions
)
.
"
\n
"
;
echo
Html
::
beginTag
(
'div'
,
$this
->
o
ptions
)
.
"
\n
"
;
echo
$this
->
renderBodyBegin
()
.
"
\n
"
;
}
...
...
@@ -136,11 +136,11 @@ class Alert extends Widget
*/
protected
function
initOptions
()
{
$this
->
htmlO
ptions
=
array_merge
(
array
(
$this
->
o
ptions
=
array_merge
(
array
(
'class'
=>
'fade in'
,
),
$this
->
htmlO
ptions
);
),
$this
->
o
ptions
);
$this
->
addCssClass
(
$this
->
htmlO
ptions
,
'alert'
);
$this
->
addCssClass
(
$this
->
o
ptions
,
'alert'
);
if
(
$this
->
closeButton
!==
null
)
{
$this
->
closeButton
=
array_merge
(
array
(
...
...
framework/yii/bootstrap/Modal.php
View file @
512a9bd1
...
...
@@ -105,7 +105,7 @@ class Modal extends Widget
$this
->
initOptions
();
echo
$this
->
renderToggleButton
()
.
"
\n
"
;
echo
Html
::
beginTag
(
'div'
,
$this
->
htmlO
ptions
)
.
"
\n
"
;
echo
Html
::
beginTag
(
'div'
,
$this
->
o
ptions
)
.
"
\n
"
;
echo
$this
->
renderHeader
()
.
"
\n
"
;
echo
$this
->
renderBodyBegin
()
.
"
\n
"
;
}
...
...
@@ -212,14 +212,14 @@ class Modal extends Widget
*/
protected
function
initOptions
()
{
$this
->
htmlO
ptions
=
array_merge
(
array
(
$this
->
o
ptions
=
array_merge
(
array
(
'class'
=>
'modal hide'
,
),
$this
->
htmlO
ptions
);
$this
->
addCssClass
(
$this
->
htmlO
ptions
,
'modal'
);
),
$this
->
o
ptions
);
$this
->
addCssClass
(
$this
->
o
ptions
,
'modal'
);
$this
->
o
ptions
=
array_merge
(
array
(
$this
->
clientO
ptions
=
array_merge
(
array
(
'show'
=>
false
,
),
$this
->
o
ptions
);
),
$this
->
clientO
ptions
);
if
(
$this
->
closeButton
!==
null
)
{
$this
->
closeButton
=
array_merge
(
array
(
...
...
@@ -234,7 +234,7 @@ class Modal extends Widget
'data-toggle'
=>
'modal'
,
),
$this
->
toggleButton
);
if
(
!
isset
(
$this
->
toggleButton
[
'data-target'
])
&&
!
isset
(
$this
->
toggleButton
[
'href'
]))
{
$this
->
toggleButton
[
'data-target'
]
=
'#'
.
$this
->
htmlO
ptions
[
'id'
];
$this
->
toggleButton
[
'data-target'
]
=
'#'
.
$this
->
o
ptions
[
'id'
];
}
}
}
...
...
framework/yii/bootstrap/TypeAhead.php
View file @
512a9bd1
...
...
@@ -21,7 +21,7 @@ use yii\helpers\Html;
* echo TypeAhead::widget(array(
* 'model' => $model,
* 'attribute' => 'country',
* '
o
ptions' => array(
* '
clientO
ptions' => array(
* 'source' => array('USA', 'ESP'),
* ),
* ));
...
...
@@ -32,7 +32,7 @@ use yii\helpers\Html;
* ```php
* echo TypeAhead::widget(array(
* 'name' => 'country',
* '
o
ptions' => array(
* '
cloentO
ptions' => array(
* 'source' => array('USA', 'ESP'),
* ),
* ));
...
...
@@ -82,9 +82,9 @@ class TypeAhead extends Widget
public
function
renderField
()
{
if
(
$this
->
model
instanceof
Model
&&
$this
->
attribute
!==
null
)
{
return
Html
::
activeTextInput
(
$this
->
model
,
$this
->
attribute
,
$this
->
htmlO
ptions
);
return
Html
::
activeTextInput
(
$this
->
model
,
$this
->
attribute
,
$this
->
o
ptions
);
}
elseif
(
$this
->
name
!==
null
)
{
return
Html
::
textInput
(
$this
->
name
,
$this
->
value
,
$this
->
htmlO
ptions
);
return
Html
::
textInput
(
$this
->
name
,
$this
->
value
,
$this
->
o
ptions
);
}
else
{
throw
new
InvalidConfigException
(
"Either 'name' or 'model' and 'attribute' properties must be specified."
);
}
...
...
framework/yii/bootstrap/Widget.php
View file @
512a9bd1
...
...
@@ -28,21 +28,21 @@ class Widget extends \yii\base\Widget
/**
* @var array the HTML attributes for the widget container tag.
*/
public
$
htmlO
ptions
=
array
();
public
$
o
ptions
=
array
();
/**
* @var array the options for the underlying Bootstrap JS plugin.
* Please refer to the corresponding Bootstrap plugin Web page for possible options.
* For example, [this page](http://twitter.github.io/bootstrap/javascript.html#modals) shows
* how to use the "Modal" plugin and the supported options (e.g. "remote").
*/
public
$
o
ptions
=
array
();
public
$
clientO
ptions
=
array
();
/**
* @var array the event handlers for the underlying Bootstrap JS plugin.
* Please refer to the corresponding Bootstrap plugin Web page for possible events.
* For example, [this page](http://twitter.github.io/bootstrap/javascript.html#modals) shows
* how to use the "Modal" plugin and the supported events (e.g. "shown").
*/
public
$
e
vents
=
array
();
public
$
clientE
vents
=
array
();
/**
...
...
@@ -53,8 +53,8 @@ class Widget extends \yii\base\Widget
public
function
init
()
{
parent
::
init
();
if
(
!
isset
(
$this
->
o
ptions
[
'id'
]))
{
$this
->
o
ptions
[
'id'
]
=
$this
->
getId
();
if
(
!
isset
(
$this
->
clientO
ptions
[
'id'
]))
{
$this
->
clientO
ptions
[
'id'
]
=
$this
->
getId
();
}
}
...
...
@@ -64,20 +64,20 @@ class Widget extends \yii\base\Widget
*/
protected
function
registerPlugin
(
$name
)
{
$id
=
$this
->
o
ptions
[
'id'
];
$id
=
$this
->
clientO
ptions
[
'id'
];
$view
=
$this
->
getView
();
$view
->
registerAssetBundle
(
static
::
$responsive
?
'yii/bootstrap/responsive'
:
'yii/bootstrap'
);
$view
->
registerAssetBundle
(
"yii/bootstrap/
$name
"
);
if
(
$this
->
o
ptions
!==
false
)
{
$options
=
empty
(
$this
->
options
)
?
''
:
Json
::
encode
(
$this
->
o
ptions
);
if
(
$this
->
clientO
ptions
!==
false
)
{
$options
=
empty
(
$this
->
clientOptions
)
?
''
:
Json
::
encode
(
$this
->
clientO
ptions
);
$js
=
"jQuery('#
$id
').
$name
(
$options
);"
;
$view
->
registerJs
(
$js
);
}
if
(
!
empty
(
$this
->
e
vents
))
{
if
(
!
empty
(
$this
->
clientE
vents
))
{
$js
=
array
();
foreach
(
$this
->
e
vents
as
$event
=>
$handler
)
{
foreach
(
$this
->
clientE
vents
as
$event
=>
$handler
)
{
$js
[]
=
"jQuery('#
$id
').on('
$event
',
$handler
);"
;
}
$view
->
registerJs
(
implode
(
"
\n
"
,
$js
));
...
...
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