You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.5 KiB
45 lines
1.5 KiB
<?php
|
|
|
|
namespace Zitec\RuleEngineBundle\Admin;
|
|
|
|
use Zitec\RuleEngineBundle\Form\Type\RuleEngineType;
|
|
use Zitec\RuleEngineBundle\Form\Type\PostconditionEngineType;
|
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
|
use Sonata\AdminBundle\Form\FormMapper;
|
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
|
|
|
/**
|
|
* Class RuleAdmin
|
|
*/
|
|
class PostconditionAdmin extends RuleAdmin
|
|
{
|
|
/**
|
|
* @param FormMapper $formMapper
|
|
*/
|
|
protected function configureFormFields(FormMapper $formMapper)
|
|
{
|
|
$fieldOptions = ['label' => false];
|
|
$parentOptions = $this->getParentFieldDescription()->getOptions();
|
|
if (!isset($parentOptions['rule_manager'])) {
|
|
throw new \RuntimeException('Missing rule manager object!');
|
|
}
|
|
$fieldOptions['rule_manager'] = $parentOptions['rule_manager'];
|
|
$formMapper
|
|
->with('General', ['class' => 'col-md-12'])
|
|
->add('active')
|
|
->add('name')
|
|
->end()
|
|
->with('Reglas', ['class' => 'col-md-12'])
|
|
->add('ruleObject', PostconditionEngineType::class, $fieldOptions)
|
|
->end()
|
|
->with('Acciones', [
|
|
'class' => 'col-md-12',
|
|
'box_class' => 'box box-solid box-success custom-form-fields',
|
|
'description' => 'Acciones a realizar',
|
|
])
|
|
->add('action', HiddenType::class,array('attr'=>array("hidden" => true)))
|
|
->end()
|
|
->end();
|
|
}
|
|
}
|