Skip to content
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

Variable "enable" does not exist #327

Open
olivsinz opened this issue Nov 13, 2017 · 2 comments
Open

Variable "enable" does not exist #327

olivsinz opened this issue Nov 13, 2017 · 2 comments

Comments

@olivsinz
Copy link

olivsinz commented Nov 13, 2017

Hi Guys!

I'm in trouble : i did all the steps to install CKEditor in my Symfony3 application, and I have one error message about variable "enable" in vendor/egeloen/ckeditor-bundle/Resources/views/Form/ckeditor_widget.html.twig (line 4).

Here's my kernel :
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new FOS\UserBundle\FOSUserBundle(),
new EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle(),
new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
];

    if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
        $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
        $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
        $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();

        if ('dev' === $this->getEnvironment()) {
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
            $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
        }
    }

    return $bundles;
}

My formType:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TextType::class, [
'label' => false,
])
->add('description', CkeditorType::class, [
'label' => false,
])
->add('categories', EntityType::class, array(
'class' => 'AppBundle:Category',
'choice_label' => 'name',
'label' => 'Choose your file',
'expanded' => false,
'multiple' => true,
))
->add('file', FileType::class, [
'label' => false,
]);

}

view content :

{{ form_start(form) }}
                  <!-- Error -->
                  {{ form_errors(form) }}

                  <div class="control-group">
                    <div class="form-group floating-label-form-group controls">
                      {{ form_label(form.name, "", {'label_attr': {'class': ''}}) }}

                      <div class="help-block text-danger">
                        {{ form_errors(form.name) }}
                      </div>
                      <div class="">
                        {{ form_widget(form.name, {'attr': {'class': '', 'placeholder' : 'Name'}}) }}
                      </div>
                    </div>
                  </div>

                  <div class="control-group">
                    <div class="form-group floating-label-form-group controls">
                      {{ form_label(form.description, "", {'label_attr': {'class': ''}}) }}

                      <div class="help-block text-danger">
                        {{ form_errors(form.description) }}
                      </div>
                      <div class="">
                        {{ form_widget(form.description, {'attr': {'class': '', 'placeholder' : 'Description'}}) }}
                      </div>
                    </div>
                  </div>

                  <div class="control-group">
                    <div class="form-group floating-label-form-group controls">
                      {{ form_label(form.categories, "", {'label_attr': {'class': ''}}) }}

                      <div class="help-block text-danger">
                        {{ form_errors(form.categories) }}
                      </div>
                      <div class="">
                        {{ form_widget(form.categories, {'attr': {'class': 'form-control', 'placeholder' : ''}}) }}
                      </div>
                    </div>
                  </div>

                  <div class="control-group">
                    <div class="form-group">
                      {{ form_row(form.file) }}
                    </div>
                  </div>

                  <div class="">
                    {{ form_rest(form) }}
                  </div>
                  <div class="row">
                    <div class="col-md-6">
                      <a href="{{ path('fichier_index') }}" class="btn btn-info btn-block btn-lg"><i class="fa fa-arrow-circle-left"></i> Back</a>
                    </div>
                    <div class="col-md-6">
                      <input type="submit" class="btn btn-success btn-lg btn-block" value="Upload" />
                      <!-- <i class="fa fa-save"></i> -->
                    </div>
                  </div>
              {{ form_end(form) }}
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

CkeditorType content :

namespace AppBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\OptionsResolver\OptionsResolver;

class CkeditorType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'attr' => array('class' => 'ckeditor')
));
}

public function getParent()
{
return TextareaType::class;
}
}

So please what's wrong?

@ShapesGraphicStudio
Copy link

ShapesGraphicStudio commented May 17, 2018

Hi,
I know it's an old thread but I'm having the same issue today.
Did you solve this ?
Do you remember how ?

EDIT
Seems like I forgot :
use FOS\CKEditorBundle\Form\Type\CKEditorType;
in my FormType.

Looks OK now.

@olivsinz
Copy link
Author

I didn't solve this.
OK I will try again later

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