CoreFiles by mySites.guru
AbstractGroupButton.php75 lines, 1,324 bytes, from Joomla_4.0.0-alpha6-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha5
md5
6ae16b242fbc1396f3d2b8ed48f0f258
sha1
b0784b8fa8b6d28d4bfd845e0cb7d25312839db8
sha256
ea0e9c012d5909156d0459f55b9e7c181f78a5d8e91535cb85a13824ae50e7d2
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  Copyright (C) 2005 - 2018 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 2 releases, Joomla 4.0.0-alpha5 to 4.0.0-alpha6. See them all, or every version of this file.