While adapting a Joomla!2.5 backend-only component to Joomla!3.3, I've ran into the issue of the toolbar in the data edition page not working at all. Only two buttons were declared: Save and Cancel; neither do anything. Upon first glance, the problem is neither on the view.html.php file, nor tmpl/edit.php. This very component is already being used in our current Joomla!2.5 website and works perfectly.
All control, model and view pages have already been updated to JControllerLegacy, JModelLegacy and JViewLegacy respectively, where applicable. Server settings' error reporting has already been set to Maximum, but there's no error or warning showing.
view.html.php
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.viewlegacy');
class MrCarrosselNoticiasViewMrCarrosselNoticias extends JViewLegacy {
function display($tpl = null){
$form = $this->get('Form');
$item = $this->get('Item');
if (count($errors = $this->get('Errors'))){
JError::raiseError(500, implode('<br />', $errors));
return false;
}
$this->form = $form;
$this->item = $item;
$this->addToolBar();
parent::display($tpl);
}
protected function addToolBar(){
$input = JFactory::getApplication()->input;
$input->set('hidemainmenu', true);
$isNew = ($this->item->cod_destaque == 0);
JToolBarHelper::title($isNew ? "Novo Destaque" : "Editando Destaque");
JToolBarHelper::save('mrcarrosselnoticias.save');
JToolBarHelper::cancel('mrcarrosselnoticias.cancel', 'JTOOLBAR_CANCEL');
}
}
tmpl/edit.php
<?php
defined('_JEXEC') or die('Restricted Access');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.modal');
?>
<form action="<?php echo JRoute::_('index.php?option=com_mrcarrosselnoticias&layout=edit&cod_destaque='.(int) $this->item->cod_destaque); ?>" method="post" name="adminForm" id="mrcarrosselnoticias-form">
<div class="form-horizontal">
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'details')); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'details', 'Detalhes do Destaque'); ?>
<div class="row-fluid">
<div class="span9">
<?php echo $this->form->getControlGroup('imagem'); ?>
<?php echo $this->form->getControlGroup('titulo'); ?>
<?php echo $this->form->getControlGroup('desc'); ?>
<?php echo $this->form->getControlGroup('link'); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
</div>
<div>
<input type="hidden" name="task" value="mrcarrosselnoticias.edit" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>