115 lines
3.4 KiB
PHP
115 lines
3.4 KiB
PHP
<?php
|
||
|
||
namespace Trinity\Bundle\NotificationBundle\Form\Type;
|
||
|
||
use Propel\PropelBundle\Form\BaseAbstractType;
|
||
use Symfony\Component\Form\FormBuilderInterface;
|
||
use Propel\PropelBundle\Validator\Constraints\UniqueObject;
|
||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||
|
||
class TemplateType extends BaseAbstractType
|
||
{
|
||
protected $options = array(
|
||
'data_class' => 'Trinity\Bundle\NotificationBundle\Model\Template',
|
||
'name' => 'template',
|
||
);
|
||
|
||
/**
|
||
* {@inheritdoc}
|
||
*/
|
||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||
{
|
||
$builder->add(
|
||
'reference',
|
||
'text',
|
||
array(
|
||
'required' => true,
|
||
'constraints' => array(
|
||
new NotBlank(),
|
||
),
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'description',
|
||
'textarea',
|
||
array(
|
||
'required' => true,
|
||
'constraints' => array(
|
||
new NotBlank(),
|
||
),
|
||
)
|
||
);
|
||
|
||
if ($options['use_ace_editor'] === true) {
|
||
$builder->add(
|
||
'content',
|
||
'ace_editor',
|
||
array(
|
||
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
||
'width' => '100%',
|
||
'height' => 750,
|
||
'font_size' => 12,
|
||
'mode' => 'ace/mode/twig',
|
||
'theme' => 'ace/theme/vibrant_ink',
|
||
'tab_size' => null,
|
||
'read_only' => false,
|
||
'use_soft_tabs' => false,
|
||
'use_wrap_mode' => false,
|
||
'show_print_margin' => null,
|
||
'highlight_active_line' => false,
|
||
'required' => true,
|
||
'constraints' => array(
|
||
new NotBlank(),
|
||
),
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'logContent',
|
||
'ace_editor',
|
||
array(
|
||
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
||
'width' => '100%',
|
||
'height' => 150,
|
||
'font_size' => 12,
|
||
'mode' => 'ace/mode/twig',
|
||
'theme' => 'ace/theme/vibrant_ink',
|
||
'tab_size' => null,
|
||
'read_only' => false,
|
||
'use_soft_tabs' => false,
|
||
'use_wrap_mode' => false,
|
||
'show_print_margin' => null,
|
||
'highlight_active_line' => false,
|
||
'required' => true,
|
||
'constraints' => array(
|
||
new NotBlank(),
|
||
),
|
||
)
|
||
);
|
||
} else {
|
||
$builder->add(
|
||
'content',
|
||
'textarea',
|
||
array(
|
||
'required' => true,
|
||
'constraints' => array(
|
||
new NotBlank(),
|
||
),
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'logContent',
|
||
'textarea',
|
||
array(
|
||
'required' => true,
|
||
'constraints' => array(
|
||
new NotBlank(),
|
||
),
|
||
)
|
||
);
|
||
}
|
||
}
|
||
}
|