Back to CoreButtonsTrait class

Method versions

public \Joomla\CMS\Toolbar\Button\CustomButton
versions
(string $typeAlias, int $itemId, int $height = 800, int $width = 500, string $text = 'JTOOLBAR_VERSIONS')
Writes a version history
Parameters
  • string $typeAlias The component and type, for example 'com_content.article'
  • int $itemId The id of the item, for example the article id.
  • int $height The height of the popup.
  • int $width The width of the popup.
  • string $text The name of the button.
Returns
  • \Joomla\CMS\Toolbar\Button\CustomButton
Since
  • 4.0.0

Method versions - Source code

/**
 * Writes a version history
 *
 * @param   string   $typeAlias  The component and type, for example 'com_content.article'
 * @param   integer  $itemId     The id of the item, for example the article id.
 * @param   integer  $height     The height of the popup.
 * @param   integer  $width      The width of the popup.
 * @param   string   $text       The name of the button.
 *
 * @return  CustomButton
 *
 * @since   4.0.0
 */
public function versions(string $typeAlias, int $itemId, int $height = 800, int $width = 500, string $text = 'JTOOLBAR_VERSIONS') : CustomButton
{
    $lang = Factory::getLanguage();
    $lang->load('com_contenthistory', JPATH_ADMINISTRATOR, $lang->getTag(), true);
    // Options array for Layout
    $options = array();
    $options['title'] = Text::_($text);
    $options['height'] = $height;
    $options['width'] = $width;
    $options['itemId'] = $typeAlias . '.' . $itemId;
    $layout = new FileLayout('joomla.toolbar.versions');
    return $this->customHtml($layout->render($options), 'version');
}