Backoffice/GenerateForm/Strategies/TinyMCEWysiwygStrategy.php
<?php
namespace OpenOrchestra\Backoffice\GenerateForm\Strategies;
use OpenOrchestra\DisplayBundle\DisplayBlock\Strategies\TinyMCEWysiwygStrategy as BaseTinyMCEWysiwygStrategy;
use OpenOrchestra\ModelInterface\Model\BlockInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
/**
* Class TinymcewysiwygStrategy
*/
class TinyMCEWysiwygStrategy extends AbstractBlockStrategy
{
/**
* @param BlockInterface $block
*
* @return bool
*/
public function support(BlockInterface $block)
{
return BaseTinyMCEWysiwygStrategy::NAME === $block->getComponent();
}
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('searchable', 'checkbox', array(
'label' => 'open_orchestra_backoffice.block.tiny_mce_wysiwyg.searchable',
'required' => false,
'group_id' => 'data',
'sub_group_id' => 'content',
));
$builder->add('htmlContent', 'oo_tinymce', array(
'constraints' => new NotBlank(),
'group_id' => 'data',
'sub_group_id' => 'content',
));
}
/**
* @return array
*/
public function getDefaultConfiguration()
{
return array(
'searchable' => true
);
}
/**
* @return string
*/
public function getName()
{
return 'tinymcewysiwyg';
}
}