1
1
1alexandr2015-06-15 05:13:07
symfony
1alexandr, 2015-06-15 05:13:07

How to connect elfinder and tinymce in symfony2?

Hello, please tell me where I am making a mistake. I'm trying to connect Eldinder and Tinymce to edit and upload images while creating articles.
Here is ArticleType

class ArticleType extends AbstractType
{

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('name', 'text')
                ->add('text', 'textarea', ['attr' => ['class' => 'tinymce', 'data-theme' => 'advanced']])
                ->add('save', 'submit');
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'App\MainBundle\Entity\Article',
        ));
    }

    public function getName()
    {
        return 'article_form';
    }

}

config.yml
stfalcon_tinymce:
    include_jquery: false
    tinymce_jquery: false
    use_callback_tinymce_init: false
    selector: .tinymce
    base_url: ~
    language: ru
    theme:
        # Simple theme: same as default theme
        simple: ~
        # Advanced theme with almost all enabled plugins
        advanced:
             plugins:
                 - "advlist autolink lists link image charmap print preview hr anchor pagebreak"
                 - "searchreplace wordcount visualblocks visualchars code fullscreen"
                 - "insertdatetime media nonbreaking save table contextmenu directionality"
                 - "emoticons template paste textcolor"
             toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview code media | forecolor backcolor emoticons | stfalcon | example"
             image_advtab: true
             file_browser_callback: 'elFinderBrowser'
             height: 300
             valid_elements: '*[*]'
             valid_children: '+body[style],+style[#text]'
             extended_valid_elements: 'style[*]'
             invalid_elements: ''
             verify_html: false
             convert_urls: false
        # BBCode tag compatible theme (see http://www.bbcode.org/reference.php)
        bbcode:
             plugins: ["bbcode, code, link, preview"]
             menubar: false
             toolbar1: "bold,italic,underline,undo,redo,link,unlink,removeformat,cleanup,code,preview"
    external_plugins: ~

# FMElfinder Configuration
fm_elfinder:
    locale: %locale% # defaults to current request locale
    editor: tinymce4 # other choices are tinymce or simple
    fullscreen: true # defaults true, applies to simple and ckeditor editors
    include_assets: true # disable if you want to handle loading of the javascript and css assets yourself
    compression: false # enable if you configured the uglifycss and uglifyjs2 assetic filters and want compression
    connector:
        debug: false # defaults to false
        roots:       # at least one root must be defined
            uploads:
                driver: LocalFileSystem
                path: uploads
                upload_allow: ['all'] #['image/png', 'image/jpg', 'image/jpeg', '']
                upload_deny:  [''] #['all']
                upload_max_size: 5M

But the editor still does not appear.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jaxel, 2015-06-15
@1alexandr

Bundle resources installed?
Are they included in the template?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question