我为我的字段视图创建了一个编辑视图。当我单击任何按钮(保存、保存和关闭、取消)时,它什么也不做。这是我的 AddToolbar 代码:
受保护的功能 addToolbar() {
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = ($this->item->id == 0);
if (isset($this->item->checked_out)) {
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
} else {
$checkedOut = false;
}
$canDo = ReportsHelper::getActions();
JToolBarHelper::title(JText::_('COM_REPORTS_TITLE_NEWREPORT'), 'newreport.png');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || ($canDo->get('core.create')))) {
JToolBarHelper::apply('field.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('field.save', 'JTOOLBAR_SAVE');
}
if (!$checkedOut && ($canDo->get('core.create'))) {
JToolBarHelper::custom('field.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::custom('field.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('field.cancel', 'JTOOLBAR_CANCEL');
} else {
JToolBarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE');
}
}
这是我在控制器文件中的代码:Field.php:
jimport('joomla.application.component.controllerform');
class ReportsControllerField extends JControllerForm
{
}
工具栏似乎不起作用。我的代码有什么问题?