CoreFiles by mySites.guru
CustomButton.php77 lines, 1,705 bytes, from Joomla_5.0.0-alpha1-Alpha-Full_Package.zip
Raw History Compare with 4.4.0-alpha4
md5
4d30080ee4450ca8432ff1acffb74c95
sha1
383b5cbeb882e4fb3f8b5d6be7bd6c7d894ba4b9
sha256
1e297d5f3f8197c3714a7692e56e48cea926f6a149a017fd35ee900f71e6a574
<?php

/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Toolbar\Button;

use Joomla\CMS\Toolbar\ToolbarButton;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Renders a custom button
 *
 * @method self html(string $value)
 * @method string getHtml()
 *
 * @since  3.0
 */
class CustomButton extends ToolbarButton
{
    /**
     * Render button HTML.
     *
     * @param   array  $options  The button options.
     *
     * @return  string  The button HTML.
     *
     * @since  4.0.0
     */
    protected function renderButton(array &$options): string
    {
        return (string) ($options['html'] ?? '');
    }

    /**
     * Fetch the HTML for the button
     *
     * @param   string  $type  Button type, unused string.
     * @param   string  $html  HTML string for the button
     * @param   string  $id    CSS id for the button
     *
     * @return  string   HTML string for the button
     *
     * @since   3.0
     *
     * @deprecated  4.3 will be removed in 6.0
     *              Use render() instead.
     */
    public function fetchButton($type = 'Custom', $html = '', $id = 'custom')
    {
        return $html;
    }

    /**
     * Method to configure available option accessors.
     *
     * @return  array
     *
     * @since  4.0.0
     */
    protected static function getAccessors(): array
    {
        return array_merge(
            parent::getAccessors(),
            [
                'html',
            ]
        );
    }
}

The same content is in 116 releases, Joomla 5.0.0-alpha1 to 6.0.0. See them all, or every version of this file.