protected function _beforeGet(KCommandContext $context)
 {
     parent::_beforeGet($context);
     if ($context->caller->getIdentifier()->name === 'submit') {
         // Load the language strings for toolbar button labels
         JFactory::getLanguage()->load('joomla', JPATH_ADMINISTRATOR);
         $this->getView()->setToolbar($this->getToolbar());
         $this->getToolbar()->addCommand('save', array('label' => 'Upload', 'icon' => 'icon-32-upload'))->addCommand('cancel', array('attribs' => array('data-novalidate' => 'novalidate')));
     }
 }
Esempio n. 2
0
    protected function _beforeGet(KCommandContext $context)
    {
        parent::_beforeGet($context);

        if ($context->caller->getIdentifier()->name === 'submit'
            || ($context->caller->getIdentifier()->name === 'document' && $context->caller->getRequest()->layout === 'form'))
        {
            // Load the language strings for toolbar button labels
            JFactory::getLanguage()->load('joomla', JPATH_ADMINISTRATOR);

            $this->getView()->setToolbar($this->getToolbar());
        }

        // Only display add document button if the user has access to add documents
        if ($context->caller->getIdentifier()->name === 'list') {
            $params = JFactory::getApplication()->getMenu()->getActive()->params;
            if ($params->get('show_add_document_button')) {
                $params->set('show_add_document_button', $this->canAdd());
            }
        }
    }