mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
parent
7839d50099
commit
ce3a564de7
@ -66,6 +66,7 @@ class ConfigController extends ActionController
|
||||
$allowedActions[] = 'roles';
|
||||
}
|
||||
$this->firstAllowedAction = array_shift($allowedActions);
|
||||
$this->getTabs()->setTitle($this->translate('Config Navigation'));
|
||||
}
|
||||
|
||||
public function devtoolsAction()
|
||||
|
@ -19,6 +19,7 @@ class Tabs extends AbstractWidget implements Countable
|
||||
* @var string
|
||||
*/
|
||||
private $baseTpl = <<< 'EOT'
|
||||
{HEADER}
|
||||
<ul class="tabs">
|
||||
{TABS}
|
||||
{DROPDOWN}
|
||||
@ -26,6 +27,13 @@ class Tabs extends AbstractWidget implements Countable
|
||||
</ul>
|
||||
EOT;
|
||||
|
||||
/**
|
||||
* Template used for the header
|
||||
*
|
||||
* @type string
|
||||
*/
|
||||
private $headerTpl = '<h2 class="sr-only">{TITLE}</h2>';
|
||||
|
||||
/**
|
||||
* Template used for the tabs dropdown
|
||||
*
|
||||
@ -87,6 +95,13 @@ EOT;
|
||||
*/
|
||||
private $closeTab = true;
|
||||
|
||||
/**
|
||||
* Title of the tab navigation
|
||||
*
|
||||
* @type string
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* Set whether the current tab is closable
|
||||
*/
|
||||
@ -309,11 +324,21 @@ EOT;
|
||||
}
|
||||
$close = $this->closeTab ? $this->renderCloseTab() : '';
|
||||
|
||||
$html = $this->baseTpl;
|
||||
$html = str_replace('{TABS}', $tabs, $html);
|
||||
$html = str_replace('{DROPDOWN}', $drop, $html);
|
||||
$html = str_replace('{CLOSE}', $close, $html);
|
||||
return $html;
|
||||
return str_replace(
|
||||
array(
|
||||
'{TABS}',
|
||||
'{DROPDOWN}',
|
||||
'{CLOSE}',
|
||||
'{HEADER}'
|
||||
),
|
||||
array(
|
||||
$tabs,
|
||||
$drop,
|
||||
$close,
|
||||
$this->renderHeader()
|
||||
),
|
||||
$this->baseTpl
|
||||
);
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
@ -372,4 +397,30 @@ EOT;
|
||||
$tabextension->apply($this);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the title of the tab navigation
|
||||
*
|
||||
* @param string $title
|
||||
* @return self
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the title into the header template
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function renderHeader()
|
||||
{
|
||||
if (! $this->title) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return str_replace('{TITLE}', $this->title, $this->headerTpl);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user