FOF30\Toolbar\Toolbar::onAdd PHP Method

onAdd() public method

Renders the toolbar for the component's Add pages
public onAdd ( ) : void
return void
    public function onAdd()
    {
        // On frontend, buttons must be added specifically
        if (!$this->container->platform->isBackend() && !$this->renderFrontendButtons) {
            return;
        }
        $option = $this->container->componentName;
        $componentName = str_replace('com_', '', $option);
        $view = $this->container->input->getCmd('view', 'cpanel');
        // Set toolbar title
        $subtitle_key = strtoupper($option . '_TITLE_' . $this->container->inflector->pluralize($view)) . '_EDIT';
        JToolBarHelper::title(JText::_(strtoupper($option)) . ': ' . JText::_($subtitle_key), $componentName);
        if (!$this->isDataView()) {
            return;
        }
        // Set toolbar icons
        if ($this->perms->edit || $this->perms->editown) {
            // Show the apply button only if I can edit the record, otherwise I'll return to the edit form and get a
            // 403 error since I can't do that
            JToolBarHelper::apply();
        }
        JToolBarHelper::save();
        if ($this->perms->create) {
            JToolBarHelper::custom('savenew', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
        }
        JToolBarHelper::cancel();
    }

Usage Example

Esempio n. 1
0
 public function onProfilesAdd()
 {
     parent::onAdd();
     JToolbarHelper::title(JText::_('COM_AKEEBA') . ': <small>' . JText::_('COM_AKEEBA_PROFILES_PAGETITLE_NEW') . '</small>', 'akeeba');
     JToolbarHelper::spacer();
     JToolbarHelper::help(null, false, 'https://www.akeebabackup.com/documentation/akeeba-backup-documentation/using-basic-operations.html#profiles-management');
 }