mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
Allow plugins to add tabs to core admin pages.
This commit is contained in:
@@ -2583,7 +2583,8 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
{
|
||||
return $this->tabs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get Tab data
|
||||
* @return array
|
||||
@@ -4321,11 +4322,38 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
|
||||
foreach($tmp as $plug=>$config)
|
||||
{
|
||||
|
||||
$form = e107::getAddon($plug, 'e_admin', $plug."_admin_form"); // class | false.
|
||||
|
||||
foreach($config['fields'] as $k=>$v)
|
||||
{
|
||||
$v['data'] = false; // disable data-saving to db table. .
|
||||
$this->fields['x_'.$plug.'_'.$k] = $v; // ie. x_plugin_key
|
||||
|
||||
$fieldName = 'x_'.$plug.'_'.$k;
|
||||
|
||||
if($v['type'] == 'method' && method_exists($form,$fieldName))
|
||||
{
|
||||
$v['method'] = $plug."_admin_form::".$fieldName;
|
||||
//echo "Found method ".$fieldName." in ".$plug."_menu_form";
|
||||
//echo $form->$fieldName();
|
||||
}
|
||||
|
||||
|
||||
$this->fields[$fieldName] = $v; // ie. x_plugin_key
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(!empty($config['tabs']))
|
||||
{
|
||||
foreach($config['tabs'] as $t=>$tb)
|
||||
{
|
||||
$this->tabs[$t] = $tb;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -5213,7 +5213,17 @@ class e_form
|
||||
$meth = (!empty($attributes['method'])) ? $attributes['method'] : $key;
|
||||
$parms['field'] = $key;
|
||||
|
||||
$ret = call_user_func_array(array($this, $meth), array($value, 'write', $parms));
|
||||
if(strpos($meth,'::')!==false)
|
||||
{
|
||||
list($className,$meth) = explode('::', $meth);
|
||||
$cls = new $className;
|
||||
}
|
||||
else
|
||||
{
|
||||
$cls = $this;
|
||||
}
|
||||
|
||||
$ret = call_user_func_array(array($cls, $meth), array($value, 'write', $parms));
|
||||
break;
|
||||
|
||||
case 'upload': //TODO - from method
|
||||
@@ -5482,14 +5492,14 @@ class e_form
|
||||
$text .= '<ul class="nav nav-tabs">';
|
||||
foreach($data['tabs'] as $i=>$label)
|
||||
{
|
||||
$class = ($i == $curTab) ? 'class="active" ' : '';
|
||||
$class = ($i === $curTab) ? 'class="active" ' : '';
|
||||
$text .= '<li '.$class.'><a href="#tab'.$i.'" data-toggle="tab">'.$label.'</a></li>';
|
||||
}
|
||||
$text .= ' </ul><div class="tab-content">';
|
||||
|
||||
foreach($data['tabs'] as $tabId=>$label)
|
||||
{
|
||||
$active = ($tabId == $curTab) ? 'active' : '';
|
||||
$active = ($tabId === $curTab) ? 'active' : '';
|
||||
$text .= '<div class="tab-pane '.$active.'" id="tab'.$tabId.'">';
|
||||
$text .= $this->renderCreateFieldset($elid, $data, $model, $tabId);
|
||||
$text .= "</div>";
|
||||
|
Reference in New Issue
Block a user