CoreFiles by mySites.guru
AbstractGroupButton.php75 lines, 1,324 bytes, from Joomla_4.0.0-alpha12-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha11
md5
a391df76b0cc3d1e43dc29c0bb889dbe
sha1
3070af77f14bafad1b93826c42d4788f332d66f8
sha256
a99ee84a90c4fb6baf4accaf1d758004cb51261ae4440430679fd6f6e8578ed9
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Toolbar\Button;

use Joomla\CMS\Toolbar\Toolbar;

/**
 * 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   3.0
	 */
	protected function fetchId()
	{
		return $this->parent->getName() . '-group-' . $this->getName();
	}
}

The same content is in 6 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha12. See them all, or every version of this file.