0

Symfony2 と Twig を使用して CMS を作成しています。

「記事の管理」セクションでは、tinymce のバンドルを使用してリッチ コンテンツを作成しています。リッチ コンテンツはデータベースに BLOB として保存されます。これは完全に機能します。問題は、記事を編集したいときです。tinymce テキストエリアにブロブを表示する方法がわかりません。私が得たのは Resource id_ # だけです。

小枝の拡張機能を作成することを考えましたが、他に簡単な解決策があるかどうかはわかりません。

誰かが私を助けることができますか?

ありがとうございます。

編集: ContentType.php

namespace FEB\EmbeddableBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class ContentType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('titulo', 'text', array('label' => 'Título :'))
                ->add('post', 'textarea', array(
                        'label' => 'Contenido a publicar :',
                        'attr' => array(
                                'class' => 'tinymce',
                                'data-theme' => 'advanced', // simple, advanced, bbcode
                                'rows' => 20,
                                'cols' =>  80
                                )

                     ))
                ->add('tipo', 'choice', array(
                        'label' => 'Clasificación de contenido :',
                        'empty_value' => 'Selecciona uno',
                        'choices' => array( 'video' => 'Video', 
                                            'imagen' => 'Imagen', 
                                            'hipertexto' => 'Hipertexto', 
                                            'unidad' => 'Artículo')
                        ))
                ->add('tags', 'entity', array(
                                                'label' => 'TAGS :',
                                                'class' =>    'FEBTagsBundle:Tag',
                                                'property' => 'tag',
                                                'empty_value' => 'Selecciona tags',
                                                'multiple' => true));
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'FEB\EmbeddableBundle\Entity\Content'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'feb_embeddablebundle_contenttype';
    }
}
4

1 に答える 1