public function loadButtonType($type, $new = false)
	{
		$signature = md5($type);
		if (isset($this->_buttons[$signature]) && $new === false)
		{
			return $this->_buttons[$signature];
		}

		$buttonClass = __NAMESPACE__ . '\\Toolbar\\Button\\' . $type;
		if (!class_exists($buttonClass))
		{
			$dirs = isset($this->_buttonPath) ? $this->_buttonPath : array();
			$file = preg_replace('/[^A-Z0-9_\.-]/i', '', str_replace('_', DIRECTORY_SEPARATOR, strtolower($type)))  . '.php';

			if ($buttonFile = $this->find($dirs, $file))
			{
				include_once $buttonFile;
			}
			else
			{
				throw new \InvalidArgumentException(\Lang::txt('JLIB_HTML_BUTTON_NO_LOAD', $buttonClass, $buttonFile), 500);
			}
		}

		if (!class_exists($buttonClass))
		{
			throw new \Exception("Module file $buttonFile does not contain class $buttonClass.", 500);
		}

		$this->_buttons[$signature] = new $buttonClass($this);

		return $this->_buttons[$signature];
	}
public function loadButtonType($type, $new = false)
	{
		$signature = md5($type);
		if (isset($this->_buttons[$signature]) && $new === false)
		{
			return $this->_buttons[$signature];
		}

		$buttonClass = __NAMESPACE__ . '\\Toolbar\\Button\\' . $type;
		if (!class_exists($buttonClass))
		{
			$dirs = isset($this->_buttonPath) ? $this->_buttonPath : array();
			$file = preg_replace('/[^A-Z0-9_\.-]/i', '', str_replace('_', DIRECTORY_SEPARATOR, strtolower($type)))  . '.php';

			if ($buttonFile = $this->find($dirs, $file))
			{
				include_once $buttonFile;
			}
			else
			{
				throw new \InvalidArgumentException(\Lang::txt('JLIB_HTML_BUTTON_NO_LOAD', $buttonClass, $buttonFile), 500);
			}
		}

		if (!class_exists($buttonClass))
		{
			throw new \Exception("Module file $buttonFile does not contain class $buttonClass.", 500);
		}

		$this->_buttons[$signature] = new $buttonClass($this);

		return $this->_buttons[$signature];
	}
public function loadButtonType ( $ type , $ new = false ) { $ signature = md5 ( $ type ) ; if ( isset ( $ this -> _buttons [ $ signature ] ) && $ new === false ) { return $ this -> _buttons [ $ signature ] ; } $ buttonClass = __NAMESPACE__ . '\\Toolbar\\Button\\' . $ type ; if ( ! class_exists ( $ buttonClass ) ) { $ dirs = isset ( $ this -> _buttonPath ) ? $ this -> _buttonPath : array ( ) ; $ file = preg_replace ( '/[^A-Z0-9_\.-]/i' , '' , str_replace ( '_' , DIRECTORY_SEPARATOR , strtolower ( $ type ) ) ) . '.php' ; if ( $ buttonFile = $ this -> find ( $ dirs , $ file ) ) { include_once $ buttonFile ; } else { throw new \ InvalidArgumentException ( \ Lang :: txt ( 'JLIB_HTML_BUTTON_NO_LOAD' , $ buttonClass , $ buttonFile ) , 500 ) ; } } if ( ! class_exists ( $ buttonClass ) ) { throw new \ Exception ( "Module file $buttonFile does not contain class $buttonClass." , 500 ) ; } $ this -> _buttons [ $ signature ] = new $ buttonClass ( $ this ) ; return $ this -> _buttons [ $ signature ] ; }
Loads a button type.

@param   string   $type  Button Type
@param   boolean  $new   False by default
@return  object
Loads a button type .