CoreFiles by mySites.guru
Form.php51 lines, 1,171 bytes, from Joomla_4.2.0-alpha3-dev-Development-Full_Package.zip
Raw History Compare with 4.2.0-alpha2
md5
da9189770e50b88e7b348b4e3e8bde90
sha1
f0db561887fd59d1fcdeb8df6e7c551211a3237c
sha256
c4467e6b9261edf203e7810ba271fd41a514bcfe0ce99047449cb4019da85456
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Service\Provider;

\defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Form\FormFactory;
use Joomla\CMS\Form\FormFactoryInterface;
use Joomla\Database\DatabaseInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;

/**
 * Service provider for the form dependency
 *
 * @since  4.0.0
 */
class Form implements ServiceProviderInterface
{
	/**
	 * Registers the service provider with a DI container.
	 *
	 * @param   Container  $container  The DI container.
	 *
	 * @return  void
	 *
	 * @since   4.0.0
	 */
	public function register(Container $container)
	{
		$container->alias('form.factory', FormFactoryInterface::class)
			->alias(FormFactory::class, FormFactoryInterface::class)
			->share(
				FormFactoryInterface::class,
				function (Container $container)
				{
					$factory = new FormFactory;
					$factory->setDatabase($container->get(DatabaseInterface::class));

					return $factory;
				},
				true
			);
	}
}

The same content is in 3 releases, Joomla 4.2.0-alpha3 to 4.2.0-beta2. See them all, or every version of this file.