mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Added option for default starting slide in carousel.
This commit is contained in:
@@ -239,9 +239,9 @@ class e_form
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Render Bootstrap Carousel
|
* Render Bootstrap Carousel
|
||||||
* @param $name : A unique name
|
* @param string $name : A unique name
|
||||||
* @param $array
|
* @param array $array
|
||||||
* @param $options : placeholder for any future options. (currently not in use)
|
* @param array $options : default, interval, pause, wrap
|
||||||
* @example
|
* @example
|
||||||
* $array = array(
|
* $array = array(
|
||||||
* 'slide1' => array('caption' => 'Slide 1', 'text' => 'first slide content' ),
|
* 'slide1' => array('caption' => 'Slide 1', 'text' => 'first slide content' ),
|
||||||
@@ -255,6 +255,8 @@ class e_form
|
|||||||
$wrap = null;
|
$wrap = null;
|
||||||
$pause = null;
|
$pause = null;
|
||||||
|
|
||||||
|
$act = varset($options['default'], 0);
|
||||||
|
|
||||||
if(isset($options['wrap']))
|
if(isset($options['wrap']))
|
||||||
{
|
{
|
||||||
$wrap = 'data-wrap="'.$options['wrap'].'"';
|
$wrap = 'data-wrap="'.$options['wrap'].'"';
|
||||||
@@ -281,7 +283,7 @@ class e_form
|
|||||||
$c = 0;
|
$c = 0;
|
||||||
foreach($array as $key=>$tab)
|
foreach($array as $key=>$tab)
|
||||||
{
|
{
|
||||||
$active = ($c == 0) ? ' class="active"' : '';
|
$active = ($c == $act) ? ' class="active"' : '';
|
||||||
$text .= '<li data-target="#'.$name.'" data-slide-to="'.$c.'" '.$active.'></li>';
|
$text .= '<li data-target="#'.$name.'" data-slide-to="'.$c.'" '.$active.'></li>';
|
||||||
$c++;
|
$c++;
|
||||||
}
|
}
|
||||||
@@ -296,7 +298,7 @@ class e_form
|
|||||||
$c=0;
|
$c=0;
|
||||||
foreach($array as $key=>$tab)
|
foreach($array as $key=>$tab)
|
||||||
{
|
{
|
||||||
$active = ($c == 0) ? ' active' : '';
|
$active = ($c == $act) ? ' active' : '';
|
||||||
$text .= '<div class="item'.$active.'" id="'.$key.'">';
|
$text .= '<div class="item'.$active.'" id="'.$key.'">';
|
||||||
$text .= $tab['text'];
|
$text .= $tab['text'];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user