for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* FormsExtension.php
*
* @copyright More in license.md
* @license https://www.ipublikuj.eu
* @author Adam Kadlec <[email protected]>
* @package iPublikuj:Forms!
* @subpackage common
* @since 1.0.0
* @date 31.01.14
*/
declare(strict_types = 1);
namespace IPub\Forms\DI;
use Nette;
use Nette\Bridges;
use Nette\DI;
use IPub\Forms;
* Form extension container
* @subpackage DI
final class FormsExtension extends DI\CompilerExtension
{
* @return void
public function loadConfiguration() : void
$builder = $this->getContainerBuilder();
$builder->addDefinition($this->prefix('factory'))
->setType(Forms\FormFactory::class)
->addTag('cms.forms');
}
* {@inheritdoc}
public function beforeCompile() : void
parent::beforeCompile();
// Install extension latte macros
$latteFactory = $builder->getDefinition($builder->getByType(Bridges\ApplicationLatte\ILatteFactory::class) ?: 'nette.latteFactory');
$latteFactory->addSetup('IPub\Forms\Latte\Macros::install(?->getCompiler())', ['@self']);
* @param Nette\Configurator $config
* @param string $extensionName
public static function register(Nette\Configurator $config, string $extensionName = 'extendedForms') : void
$config->onCompile[] = function (Nette\Configurator $config, Nette\DI\Compiler $compiler) use ($extensionName) {
$compiler->addExtension($extensionName, new FormsExtension());
};