Created
May 17, 2013 08:50
-
-
Save mjuchli/5597842 to your computer and use it in GitHub Desktop.
A simple hack to issue https://github.com/sonata-project/SonataFormatterBundle/issues/19
Data is stored in content instead of rawContent.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This file is part of the Sonata project. | |
* | |
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org> | |
* | |
* For the full copyright and license information, please view the LICENSE | |
* file that was distributed with this source code. | |
*/ | |
namespace Application\Sonata\FormatterBundle\Block; | |
use Sonata\FormatterBundle\SonataFormatterBundle; | |
use Symfony\Component\HttpFoundation\Response; | |
use Sonata\AdminBundle\Form\FormMapper; | |
use Sonata\AdminBundle\Validator\ErrorElement; | |
use Sonata\BlockBundle\Model\BlockInterface; | |
use Sonata\BlockBundle\Block\BaseBlockService; | |
use Sonata\FormatterBundle\Block\FormatterBlockService as BaseFormatterBlockService; | |
/** | |
* In order to keep data in textarea, data will be stored in content (not rawContent). | |
* For more information see issue: https://github.com/sonata-project/SonataFormatterBundle/issues/19 | |
* | |
* @author Marc Juchli <mj@codag.ch> | |
*/ | |
class FormatterBlockService extends BaseFormatterBlockService | |
{ | |
/** | |
* {@inheritdoc} | |
*/ | |
public function buildEditForm(FormMapper $formMapper, BlockInterface $block) | |
{ | |
$formMapper->add('settings', 'sonata_type_immutable_array', array( | |
'keys' => array( | |
array('format', 'sonata_formatter_type_selector', array( | |
'source' => 'content', | |
'target' => '[content]', | |
'listener' => true, | |
)), | |
array('content', 'textarea', array()), | |
) | |
)); | |
} | |
public function getParent() | |
{ | |
return 'Formatter'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment