Skip to content

Elfinder Form Type #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xorgxx opened this issue Apr 20, 2015 · 16 comments
Closed

Elfinder Form Type #140

xorgxx opened this issue Apr 20, 2015 · 16 comments

Comments

@xorgxx
Copy link

xorgxx commented Apr 20, 2015

hi

i try to add Elfinder Form Type this is my config :

 form:
            locale: %locale% # defaults to current request locale
            editor: form # other choices are tinymce or simple, and form
#            showhidden: false # defaults to false
            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
            connector:
                debug: false # defaults to false
                roots:       # at least one root must be defined
                    uploads1:
                        driver: LocalFileSystem
                        path: bundles/neocore/images
                        upload_allow: ['image/png', 'image/jpg', 'image/jpeg']
                        upload_deny: ['all']
                        upload_max_size: 2M

here declaration in my form type :

   public function buildForm ( FormBuilderInterface $builder , array $options )
    {
        $builder
            ->add ( 'title' )
            ->add ( 'subtitle' )
            ->add ( 'Norder' )
            ->add ( 'teaser' )
            ->add ( 'article' , 'ckeditor' )
            ->add ( 'publish' )
            ->add ( 'tool' )
            ->add ( '_local' , 'choice' , array (
                'choices'     => array ('fr' => 'Fr' , 'en' => 'En') ,
//                        'preferred_choices' => array ('fr') ,
                'empty_value' => 'Choisissez une option' ,
            )
            )
            ->add ( 'block' )
            ->add ( 'img','elfinder', array(
                'instance'=>'form',
                'enable'=>true,
                'attr'   => [
                    'class' => 'form-control'
                ]))
            ->add ( 'icon' );
    }

and i get this error :

TypeError: $ is not a function
var CKEDITOR_BASEPATH = "/bundles/ivoryckeditor/";

if clic on the field img it das not give elfinder.
can you help?

@xorgxx
Copy link
Author

xorgxx commented Apr 20, 2015

i use jquery-1.11.1.min.js

@helios-ag
Copy link
Owner

Have you included jquery on to page before rendering form?

@xorgxx
Copy link
Author

xorgxx commented Apr 20, 2015

yes, because i call the form with ajax

@helios-ag
Copy link
Owner

May be it's because of the ckeditor presence, probably ckeditor adds jquery by self. Check rendered page(and remove unnecessary library links) . Or post source of the page somewhere, so i can inspect it.

@xorgxx
Copy link
Author

xorgxx commented Apr 20, 2015

so to try i swith off ckeditor but now i get :

TypeError: $ is not a function
$('[data-type="elfinder-input-field"][id="neo_articlebundle_article_img"]').on("...

and if i clic i get nada

@xorgxx
Copy link
Author

xorgxx commented Apr 20, 2015

i user symfony 2.6.6, elfender 5.0.4, js 1.11.1

@xorgxx
Copy link
Author

xorgxx commented Apr 20, 2015

i just try the page in php meaning that i deed not call with ajax and all work well ckeditor with elfinder.
when i call this page (the same in php) by ajax i just take all header and footer,... to live only content i want.

@xorgxx
Copy link
Author

xorgxx commented Apr 20, 2015

i just chech but ckeditor it simce to return bad url to image!
it just put haf of the url not all the starting

@xorgxx
Copy link
Author

xorgxx commented Apr 20, 2015

it shud be

bundles/neoncore/images/loader.png

it give

/images\loader.png

@xorgxx
Copy link
Author

xorgxx commented Apr 21, 2015

so i deed again same test. this time i deleted from symfony, all Ckeditorbundle and live only Elfinder.
clean the cache and try again and i get this error :

TypeError: $ is not a function
$('[data-type="elfinder-input-field"][id="neo_articlebundle_article_img"]').on("...

all the reste on the page work well i meaning Js fonctionality(ajax call). meaning also that js 1.11.1 is charge.

again !! this probleme apen only on return responce by ajax, it work fine on php normal page call !!!

if you want i can try to give all the page code?

@xorgxx xorgxx closed this as completed Apr 21, 2015
@xorgxx xorgxx reopened this Apr 21, 2015
@xorgxx
Copy link
Author

xorgxx commented Apr 21, 2015

@xorgxx
Copy link
Author

xorgxx commented Apr 21, 2015

@xorgxx
Copy link
Author

xorgxx commented Apr 21, 2015

in perveiw ver 3.0.1 it was working well in one of my projet so i will try to go back form 5.0.4 to 3.0.1 and come back

@xorgxx
Copy link
Author

xorgxx commented Apr 21, 2015

same probleme

@xorgxx
Copy link
Author

xorgxx commented Apr 21, 2015

i find the probleme maibe, in my preview projet i have on all form "recharge js with 'genemuBundle'" not in my new projet.

how i can include all css and js in my main projet?

@xorgxx
Copy link
Author

xorgxx commented May 2, 2015

her is my solution :

so before i render he view i have "swicth" of methode for render the view
{% extends app.request.xmlHttpRequest ? neo_base.templates.partial : neo_base.templates.full %}
then in the first one "full" i have all twig :

<!doctype html>
<html {{ sonata_seo_html_attributes() }}>

<!-- Static HEADER -->
{% include '@NeoCoreConvertible/Style/Include/Header.html.twig' %}

<body>
{#<!-- Body -->#}
{% block body %}
    <!-- Container -->
    <div id="container" class="">
.......

in the "partial " i have now this :

    {% block javascripts %}
        {% javascripts
        'bundles/neocoreconvertible/js/jquery.min.js'
        'bundles/neocoreconvertible/js/jquery.migrate.js'

        filter='yui_js'
        output='assets/js/neoajax.js' %}
        <script language="javascript" type="text/javascript" src="{{ asset_url }}"></script>
        {% endjavascripts %}

        <!--[if lt IE 9]>
        <script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
    {% endblock %}

{% block content %}


{% endblock content %}

to be honnest i dont think that it is very good pratice, but it work well !!!!

hope it can help.

@xorgxx xorgxx closed this as completed May 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants