Back to ToolbarHelper class

Method modal

public static void
(mixed $targetModalId, mixed $icon, mixed $alt, mixed $class = 'btn-primary')
Displays a modal button
Parameters
  • string $targetModalId ID of the target modal box
  • string $icon Icon class to show on modal button
  • string $alt Title for the modal button
  • string $class The button class
Returns
  • void
Since
  • 3.2
Class: ToolbarHelper
Project: Joomla

Method modal - Source code

/**
 * Displays a modal button
 *
 * @param   string  $targetModalId  ID of the target modal box
 * @param   string  $icon           Icon class to show on modal button
 * @param   string  $alt            Title for the modal button
 * @param   string  $class          The button class
 *
 * @return  void
 *
 * @since   3.2
 */
public static function modal($targetModalId, $icon, $alt, $class = 'btn-primary')
{
    $title = Text::_($alt);
    $dhtml = '<joomla-toolbar-button><button data-bs-toggle="modal" data-bs-target="#' . $targetModalId . '" class="btn ' . $class . '">
			<span class="' . $icon . ' icon-fw" title="' . $title . '"></span> ' . $title . '</button></joomla-toolbar-button>';
    $bar = Toolbar::getInstance('toolbar');
    $bar->appendButton('Custom', $dhtml, $alt);
}