1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-12 17:44:37 +02:00

Added options to e_form->carousel() to disable navigation and indicators. Custom navigation can now display a custom label when 'label' is included in the carousel array.

This commit is contained in:
Cameron
2020-02-19 10:25:22 -08:00
parent 0dbad5d72b
commit b59e55339c
2 changed files with 25 additions and 9 deletions

View File

@@ -594,7 +594,7 @@ class e_form
* Render Bootstrap Carousel
* @param string $name : A unique name
* @param array $array
* @param array $options : default, interval, pause, wrap
* @param array $options : default, interval, pause, wrap, navigation, indicators
* @return string|array
* @example
* $array = array(
@@ -603,7 +603,7 @@ class e_form
* 'slide3' => array('caption' => 'Slide 3', 'text' => 'third slide content' )
* );
*/
function carousel($name="e-carousel", $array, $options = null)
function carousel($name="e-carousel", $array=array(), $options = null)
{
$interval = null;
$wrap = null;
@@ -628,13 +628,16 @@ class e_form
$pause = 'data-pause="'.$options['pause'].'"';
}
$navigation = isset($options['navigation']) ? $options['navigation'] : true;
$indicate = isset($options['indicators']) ? $options['indicators'] : true;
$start ='
<!-- Carousel -->
<div id="'.$name.'" class="carousel slide" data-ride="carousel" '.$interval.' '.$wrap.' '.$pause.'>';
if(count($array) > 1)
if($indicate && (count($array) > 1))
{
$indicators = '
<!-- Indicators -->
@@ -663,7 +666,8 @@ class e_form
foreach($array as $key=>$tab)
{
$active = ($c == $act) ? ' active' : '';
$inner .= '<div class="carousel-item item'.$active.'" id="'.$key.'">';
$label = !empty($tab['label']) ? ' data-label="'.$tab['label'].'"' : '';
$inner .= '<div class="carousel-item item'.$active.'" id="'.$key.'"'.$label.'>';
$inner .= $tab['text'];
if(!empty($tab['caption']))
@@ -678,7 +682,7 @@ class e_form
$inner .= '
</div>';
if(count($array) > 1)
if($navigation && (count($array) > 1))
{
$controls = '
<a class="left carousel-control carousel-left" href="#'.$name.'" role="button" data-slide="prev">