protected function renderButtons($view, $task)
{
// Prevent phpStorm from complaining
if ($view) {
}
if ($task) {
}
$platform = $this->container->platform;
if ($platform->isCli()) {
return;
}
// Do not render buttons unless we are in the the frontend area and we are asked to do so
$toolbar = $this->container->toolbar;
$renderFrontendButtons = $toolbar->getRenderFrontendButtons();
// Load main backend language, in order to display toolbar strings
// (JTOOLBAR_BACK, JTOOLBAR_PUBLISH etc etc)
$platform->loadTranslations('joomla');
if ($platform->isBackend() || !$renderFrontendButtons) {
return;
}
$bar = \JToolBar::getInstance('toolbar');
$items = $bar->getItems();
$substitutions = array('icon-32-new' => 'icon-plus', 'icon-32-publish' => 'icon-eye-open', 'icon-32-unpublish' => 'icon-eye-close', 'icon-32-delete' => 'icon-trash', 'icon-32-edit' => 'icon-edit', 'icon-32-copy' => 'icon-th-large', 'icon-32-cancel' => 'icon-remove', 'icon-32-back' => 'icon-circle-arrow-left', 'icon-32-apply' => 'icon-ok', 'icon-32-save' => 'icon-hdd', 'icon-32-save-new' => 'icon-repeat');
if (isset(\JFactory::getApplication()->JComponentTitle)) {
$title = \JFactory::getApplication()->JComponentTitle;
} else {
$title = '';
}
$html = array();
$actions = array();
// We have to use the same id we're using inside other renderers
$html[] = '<div class="well" id="FOFHeaderContainer">';
$html[] = '<div class="titleContainer">' . $title . '</div>';
$html[] = '<div class="buttonsContainer">';
foreach ($items as $node) {
$type = $node[0];
$button = $bar->loadButtonType($type);
if ($button !== false) {
/**
if (method_exists($button, 'fetchId'))
{
$id = call_user_func_array(array(&$button, 'fetchId'), $node);
}
else
{
$id = null;
}
/**/
$action = call_user_func_array(array(&$button, 'fetchButton'), $node);
$action = str_replace('class="toolbar"', 'class="toolbar btn"', $action);
$action = str_replace('<span ', '<i ', $action);
$action = str_replace('</span>', '</i>', $action);
$action = str_replace(array_keys($substitutions), array_values($substitutions), $action);
$actions[] = $action;
}
}
$html = array_merge($html, $actions);
$html[] = '</div>';
$html[] = '</div>';
echo implode("\n", $html);
}