Example #1
0
 /**
  * If the method is called with one of the standard Joomla toolbar buttons
  * translate the label correctly
  */
 public function addCommand($name, $config = array())
 {
     if (version_compare(JVERSION, '1.6', '>=') && !isset($config['label']) && in_array($name, self::$_default_buttons)) {
         $config['label'] = 'JTOOLBAR_' . $name;
     }
     return parent::addCommand($name, $config);
 }
Example #2
0
    /**
	 * Get the list of commands
	 *
	 * Will attempt to use information from the xml manifest if possible
	 *
	 * @return  array
	 */
	public function getCommands()
	{
	    $name     = $this->getController()->getIdentifier()->name;
	    $package  = $this->_identifier->package;
	    $manifest = JPATH_ADMINISTRATOR.'/components/com_'.$package.'/manifest.xml';

	    if(file_exists($manifest))
	    {
	        $xml = simplexml_load_file($manifest);
	        
	        if(isset($xml->administration->submenu)) 
	        {
	            foreach($xml->administration->submenu->children() as $menu)
	            {
	                $view = (string)$menu['view'];
	                
	                $this->addCommand(JText::_((string)$menu), array(
	            		'href'   => JRoute::_('index.php?option=com_'.$package.'&view='.$view),
	            		'active' => ($name == KInflector::singularize($view))
	                ));
	            }
	        }
	    }
	
	    return parent::getCommands();   
	}
Example #3
0
 /**
  * Get the sidebar links
  *
  * @return  array
  */
 public function getCommands()
 {
     $name = $this->getController()->getIdentifier()->name;
     $this->addCommand('Components', array('href' => JRoute::_('index.php?option=com_installer&view=components'), 'active' => $name == 'component'));
     $this->addCommand('Modules', array('href' => JRoute::_('index.php?option=com_installer&view=modules'), 'active' => $name == 'module'));
     $this->addCommand('Plugins', array('href' => JRoute::_('index.php?option=com_installer&view=plugins'), 'active' => $name == 'plugin'));
     $this->addCommand('Languages', array('href' => JRoute::_('index.php?option=com_installer&view=languages'), 'active' => $name == 'language'));
     $this->addCommand('Templates', array('href' => JRoute::_('index.php?option=com_installer&view=templates'), 'active' => $name == 'template'));
     return parent::getCommands();
 }