Backoffice/DisplayBlock/Strategies/TinyMCEWysiwygStrategy.php
<?php
namespace OpenOrchestra\Backoffice\DisplayBlock\Strategies;
use OpenOrchestra\DisplayBundle\DisplayBlock\Strategies\TinyMCEWysiwygStrategy as BaseTinyMCEWysiwygStrategy;
use OpenOrchestra\ModelInterface\Model\ReadBlockInterface;
use Symfony\Component\HttpFoundation\Response;
/**
* Class TinyMCEWysiwygStrategy
*/
class TinyMCEWysiwygStrategy extends AbstractDisplayBlockStrategy
{
/**
* Check if the strategy support this block
*
* @param ReadBlockInterface $block
*
* @return boolean
*/
public function support(ReadBlockInterface $block)
{
return BaseTinyMCEWysiwygStrategy::NAME == $block->getComponent();
}
/**
* Perform the show action for a block
*
* @param ReadBlockInterface $block
*
* @return Response
*/
public function show(ReadBlockInterface $block)
{
return $this->render(
'OpenOrchestraBackofficeBundle:Block/TinyMCEWysiwyg:show.html.twig',
array('htmlContent' => $this->toString($block))
);
}
/**
* @param ReadBlockInterface $block
*
* @return string
*/
public function toString(ReadBlockInterface $block)
{
return strip_tags($block->getAttribute('htmlContent'));
}
/**
* Get the name of the strategy
*
* @return string
*/
public function getName()
{
return 'TinyMCEWysiwyg';
}
}