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
d42cfd6f
Commit
d42cfd6f
authored
May 22, 2013
by
Antonio Ramirez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some other fixes
parent
3ca4de8f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
17 deletions
+22
-17
Carousel.php
framework/yii/bootstrap/Carousel.php
+22
-17
No files found.
framework/yii/bootstrap/Carousel.php
View file @
d42cfd6f
...
...
@@ -21,12 +21,12 @@ use yii\helpers\Html;
* ```php
* echo Carousel::widget(array(
* 'items' => array(
* '
http://twitter.github.io/bootstrap/assets/img/bootstrap-mdo-sfmoma-01.jpg
',
* '
<img src="http://twitter.github.io/bootstrap/assets/img/bootstrap-mdo-sfmoma-01.jpg"/>
',
* array(
* 'content' => '
http://twitter.github.io/bootstrap/assets/img/bootstrap-mdo-sfmoma-02.jpg
',
* 'content' => '
<img src="http://twitter.github.io/bootstrap/assets/img/bootstrap-mdo-sfmoma-02.jpg"/>
',
* ),
* array(
* 'content' => '
http://twitter.github.io/bootstrap/assets/img/bootstrap-mdo-sfmoma-03.jpg
',
* 'content' => '
<img src="http://twitter.github.io/bootstrap/assets/img/bootstrap-mdo-sfmoma-03.jpg"/>
',
* 'options' => array(...)
* 'caption' => '<h4>This is title</h5><p>This is the caption text</p>'
* ),
...
...
@@ -114,7 +114,7 @@ class Carousel extends Widget
ob_start
();
echo
Html
::
beginTag
(
'div'
,
array
(
'class'
=>
'carousel-inner'
))
.
"
\n
"
;
for
(
$i
=
0
,
$ln
=
count
(
$this
->
items
);
$i
<
$ln
;
$i
++
)
{
echo
$this
->
renderItem
(
$this
->
items
[
$i
],
$i
);
$this
->
renderItem
(
$this
->
items
[
$i
],
$i
);
}
echo
Html
::
endTag
(
'div'
)
.
"
\n
"
;
return
ob_get_clean
();
...
...
@@ -127,22 +127,27 @@ class Carousel extends Widget
*/
public
function
renderItem
(
$item
,
$index
)
{
$itemOptions
=
ArrayHelper
::
getValue
(
$item
,
'options'
,
array
());
if
(
is_string
(
$item
))
{
$itemOptions
=
array
();
$itemContent
=
$item
;
$itemCaption
=
''
;
}
else
{
$itemOptions
=
ArrayHelper
::
getValue
(
$item
,
'options'
,
array
());
$itemContent
=
$item
[
'content'
];
// if not string, must be array, force required key
$itemCaption
=
ArrayHelper
::
getValue
(
$item
,
'caption'
);
if
(
$itemCaption
)
{
$itemCaption
=
Html
::
tag
(
'div'
,
$itemCaption
,
array
(
'class'
=>
'carousel-caption'
));
}
}
$this
->
addCssClass
(
$itemOptions
,
'item'
);
if
(
$index
===
0
)
{
$this
->
addCssClass
(
$itemOptions
,
'active'
);
}
echo
Html
::
beginTag
(
'div'
,
$itemOptions
)
.
"
\n
"
;
echo
is_string
(
$item
)
?
$item
:
$item
[
'content'
];
// if not string, must be array, force required key
if
(
ArrayHelper
::
getValue
(
$item
,
'caption'
))
{
echo
ArrayHelper
::
getValue
(
$item
,
'caption'
);
}
echo
$itemContent
.
"
\n
"
;
echo
$itemCaption
.
"
\n
"
;
echo
Html
::
endTag
(
'div'
)
.
"
\n
"
;
}
/**
...
...
@@ -150,7 +155,7 @@ class Carousel extends Widget
*/
public
function
renderPreviousAndNext
()
{
if
(
$this
->
controls
===
false
)
{
if
(
$this
->
controls
===
false
||
!
(
isset
(
$this
->
controls
[
'left'
])
&&
isset
(
$this
->
controls
[
'left'
]))
)
{
return
;
}
echo
Html
::
a
(
$this
->
controls
[
'left'
],
'#'
.
$this
->
options
[
'id'
],
array
(
...
...
@@ -161,7 +166,6 @@ class Carousel extends Widget
Html
::
a
(
$this
->
controls
[
'right'
],
'#'
.
$this
->
options
[
'id'
],
array
(
'class'
=>
'right carousel-control'
,
'data-slide'
=>
'next'
))
.
"
\n
"
;
));
}
}
\ No newline at end of file
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