Joomla!2.5 component ported to J!3.3: toolbar not working

135 views Asked by At

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.

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');
    }
}
0

There are 0 answers