56 lines
1.3 KiB
Plaintext
56 lines
1.3 KiB
Plaintext
<?php
|
||
|
||
namespace Trinity\Bundle\EditorialBlockBundle\Form\Type;
|
||
|
||
use Propel\PropelBundle\Form\BaseAbstractType;
|
||
use Symfony\Component\Form\FormBuilderInterface;
|
||
|
||
class EditorialBlockType extends BaseAbstractType
|
||
{
|
||
protected $options = array(
|
||
'data_class' => 'Trinity\Bundle\EditorialBlockBundle\Model\EditorialBlock',
|
||
'name' => 'editorialblock',
|
||
);
|
||
|
||
/**
|
||
* {@inheritdoc}
|
||
*/
|
||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||
{
|
||
$builder->add('name');
|
||
|
||
$builder->add(
|
||
'content',
|
||
'textarea',
|
||
array(
|
||
'attr' => array(
|
||
'class' => 'tinymce',
|
||
'data-theme' => 'advanced',
|
||
)
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'action',
|
||
'choice',
|
||
array(
|
||
'required' => false,
|
||
'choices' => $this->getActions(),
|
||
)
|
||
);
|
||
}
|
||
|
||
public function getActions()
|
||
{
|
||
$actions = array();
|
||
|
||
if (is_array($this->getOption('actions'))) {
|
||
foreach ($this->getOption('actions') as $action) {
|
||
$actions[$action['action']] = $action['title'];
|
||
}
|
||
}
|
||
|
||
return $actions;
|
||
}
|
||
}
|