Back to ToolbarButton class

Method render

public string
render
(mixed &$definition = null)
Get the HTML to render the button
Parameters
  • array & $definition Parameters to be passed
Returns
  • string
Since
  • 3.0
-
  • \Exception
Class: ToolbarButton
Project: Joomla

Method render - Source code

/**
 * Get the HTML to render the button
 *
 * @param   array  &$definition  Parameters to be passed
 *
 * @return  string
 *
 * @since   3.0
 *
 * @throws \Exception
 */
public function render(&$definition = null)
{
    if ($definition === null) {
        $action = $this->renderButton($this->options);
    } elseif (\is_array($definition)) {
        $action = $this->fetchButton(...$definition);
    } else {
        throw new \InvalidArgumentException('Wrong argument: $definition, should be NULL or array.');
    }
    // Build the HTML Button
    $layout = new FileLayout('joomla.toolbar.base');
    return $layout->render(['action' => $action, 'options' => $this->options]);
}