/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void|boolean
*
* @since 3.2
* @throws \Exception
*/
public function display($tpl = null)
{
$state = $this->get('State');
$items = $this->get('Items');
$parent = $this->get('Parent');
$app = Factory::getApplication();
// Check for errors.
if (\count($errors = $this->get('Errors'))) {
$app->enqueueMessage($errors, 'error');
return false;
}
if ($items === false) {
$app->enqueueMessage(Text::_('JGLOBAL_CATEGORY_NOT_FOUND'), 'error');
return false;
}
if ($parent == false) {
$app->enqueueMessage(Text::_('JGLOBAL_CATEGORY_NOT_FOUND'), 'error');
return false;
}
$params =& $state->params;
$items = array($parent->id => $items);
// Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx', ''), ENT_COMPAT, 'UTF-8');
$this->maxLevelcat = $params->get('maxLevelcat', -1) < 0 ? PHP_INT_MAX : $params->get('maxLevelcat', PHP_INT_MAX);
$this->params =& $params;
$this->parent =& $parent;
$this->items =& $items;
$this->prepareDocument();
parent::display($tpl);
}