deblan.tv/vendor/trinity/src/Trinity/Bundle/NotificationBundle/Form/Type/TemplateType.php

115 lines
3.4 KiB
PHP
Raw Normal View History

2015-03-02 21:57:49 +01:00
<?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(),
),
)
);
2015-09-14 14:53:34 +02:00
if (isset($options['use_ace_editor']) && $options['use_ace_editor'] === true) {
2015-03-02 21:57:49 +01:00
$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(),
),
)
);
}
}
}