mirror of
https://github.com/e107inc/e107.git
synced 2025-08-08 07:36:32 +02:00
Bootstrap Tabs method added to form handler.
This commit is contained in:
@@ -177,6 +177,55 @@ class e_form
|
|||||||
return $this->text($name, $value, $maxlength, $options);
|
return $this->text($name, $value, $maxlength, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render Bootstrap Tabs
|
||||||
|
* @param $array
|
||||||
|
* @param $options
|
||||||
|
* @example
|
||||||
|
* $array = array(
|
||||||
|
* 'home' => array('caption' => 'Home', 'text' => 'some tab content' ),
|
||||||
|
* 'other' => array('caption' => 'Other', 'text' => 'second tab content' )
|
||||||
|
* );
|
||||||
|
*/
|
||||||
|
function tabs($array,$options = array())
|
||||||
|
{
|
||||||
|
|
||||||
|
$text ='
|
||||||
|
<!-- Nav tabs -->
|
||||||
|
<ul class="nav nav-tabs">';
|
||||||
|
|
||||||
|
$c = 0;
|
||||||
|
foreach($array as $key=>$tab)
|
||||||
|
{
|
||||||
|
$active = ($c == 0) ? ' class="active"' : '';
|
||||||
|
$text .= '<li'.$active.'><a href="#'.$key.'" data-toggle="tab">'.$tab['caption'].'</a></li>';
|
||||||
|
$c++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= '</ul>';
|
||||||
|
|
||||||
|
$text .= '
|
||||||
|
<!-- Tab panes -->
|
||||||
|
<div class="tab-content">';
|
||||||
|
|
||||||
|
$c=0;
|
||||||
|
foreach($array as $key=>$tab)
|
||||||
|
{
|
||||||
|
$active = ($c == 0) ? ' active' : '';
|
||||||
|
$text .= '<div class="tab-pane'.$active.'" id="'.$key.'">'.$tab['text'].'</div>';
|
||||||
|
$c++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= '
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text-Field Form Element
|
* Text-Field Form Element
|
||||||
* @param $name
|
* @param $name
|
||||||
|
Reference in New Issue
Block a user