CoreFiles by mySites.guru
AbstractGroupButton.php79 lines, 1,590 bytes, from Joomla_6.2.1-rc1-Release_Candidate-Full_Package.zip
Raw History Compare with 6.2.0-rc2
md5
074e0ce16172915f3927663b381b1d60
sha1
c39b926f874f7db7c2ed2d409841357a7fd548fb
sha256
a751408c0d661a74edaf4ae61f60c4b6fdc80b4655ab3d2b675ce0ba08fbc389
<?php

/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2018 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\Toolbar;

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

/**
 * The AbstractGroupButton class.
 *
 * @since  4.0.0
 */
abstract class AbstractGroupButton extends BasicButton
{
    /**
     * The child Toolbar instance.
     *
     * @var  Toolbar
     *
     * @since  4.0.0
     */
    protected $child;

    /**
     * Add children buttons as dropdown.
     *
     * @param   callable  $handler  The callback to configure dropdown items.
     *
     * @return  static
     *
     * @since  4.0.0
     */
    public function configure(callable $handler): self
    {
        $child = $this->getChildToolbar();

        $handler($child);

        return $this;
    }

    /**
     * Get child toolbar.
     *
     * @return  Toolbar  Return new child Toolbar instance.
     *
     * @since   4.0.0
     */
    public function getChildToolbar(): Toolbar
    {
        if (!$this->child) {
            $this->child = $this->parent->createChild($this->getName() . '-children');
        }

        return $this->child;
    }

    /**
     * Get the button CSS Id.
     *
     * @return  string  Button CSS Id
     *
     * @since   4.0.0
     */
    protected function fetchId()
    {
        return $this->parent->getName() . '-group-' . $this->getName();
    }
}

The same content is in 225 releases, Joomla 4.2.1 to 6.2.1-rc1. See them all, or every version of this file.