form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors), 500); } $this->addToolbar(); parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $isNew = ($this->item->id == 0); $canDo = JHelperContent::getActions('com_redirect'); JToolbarHelper::title($isNew ? JText::_('COM_REDIRECT_MANAGER_LINK_NEW') : JText::_('COM_REDIRECT_MANAGER_LINK_EDIT'), 'refresh redirect'); // If not checked out, can save the item. if ($canDo->get('core.edit')) { JToolbarHelper::apply('link.apply'); JToolbarHelper::save('link.save'); } /** * This component does not support Save as Copy due to uniqueness checks. * While it can be done, it causes too much confusion if the user does * not change the Old URL. */ if ($canDo->get('core.edit') && $canDo->get('core.create')) { JToolbarHelper::save2new('link.save2new'); } if (empty($this->item->id)) { JToolbarHelper::cancel('link.cancel'); } else { JToolbarHelper::cancel('link.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::help('JHELP_COMPONENTS_REDIRECT_MANAGER_EDIT'); } }