Source code for file /joomla/html/toolbar.php
Documentation is available at toolbar.php
* @version $Id: toolbar.php 6638 2007-02-15 20:58:23Z Jinx $
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
// Check to ensure this file is within the rest of the framework
* @package Joomla.Framework
var $_buttons =
array ();
* Directories, where button types can be stored
var $_buttonDirs =
array ();
* @param string The toolbar name
* @var string The type of setup file
jimport('joomla.html.toolbar.button');
if (!defined('JBUTTON_INCLUDE_PATH')) {
* Returns a reference to a global JToolBar object, only creating it if it
* This method must be invoked as:
* <pre> $toolbar = & JToolBar::getInstance( $name );</pre>
* @param string $name The name of the toolbar.
* @return JToolBar The JToolBar object.
if (!isset
($instances)) {
if (empty ($instances[$name])) {
return $instances[$name];
* @param string The name of the param
* @param string The value of the parameter
* @return string The set value
// Push button onto the end of the toolbar array
* @param string The name of the param
* @param mixed The default value if not found
// Insert button into the front of the toolbar array
* @param string The name of the control, or the default text area if a setup file is not found
$html[] =
'<div class="toolbar" id="'.
$this->_name.
'">';
$html[] =
'<table class="toolbar"><tr>';
// Render each button in the toolbar
foreach ($this->_bar as $button)
$html[] =
'</tr></table>';
* Render a parameter type
* @param object A param tag node
* @param string The control name
* @return array Any array of the label, the form element and the tooltip
return JText::_('Button not defined for type').
' = '.
$type;
return $button->render($node);
* @param string buttonType
if (isset
($this->_buttons[$signature]) &&
$new ===
false) {
return $this->_buttons[$signature];
$buttonClass =
'JButton'.
$type;
if (isset
($this->_buttonDirs))
$dirs =
$this->_buttonDirs;
if (@ include_once $buttonFile)
JError::raiseWarning( 'SOME_ERROR_CODE', "Could not load module $buttonClass ($buttonFile)." );
//return JError::raiseError( 'SOME_ERROR_CODE', "Module file $buttonFile does not contain class $buttonClass." );
$this->_buttons[$signature] =
new $buttonClass($this);
return $this->_buttons[$signature];
* Add a directory where JToolBar should search for button types
* You may either pass a string or an array of directories.
* {@link JParameter} will be searching for an element type in the same order you
* added them. If the parameter type cannot be found in the custom folders,
* it will look in JParameter/types.
* @param string|array directory or directories to search.
$this->_buttonDirs =
array_merge($this->_buttonDirs, $dir);
return JBUTTON_INCLUDE_PATH;