2016-05-06 44 views
0

我使用IvoryCKEditorBundle(http://symfony.com/doc/master/bundles/IvoryCKEditorBundle/index.htmlSymfony | CKEditor的佔位符

我不能找到一種方法,在buildform配置中添加一個佔位符。 這是行不通的:

->add('text', CKEditorType::class, array(
      'attr' => array(
       'placeholder' => 'Your text ...' 
      ) 
     )) 

我該怎麼做?我必須在JQuery中做到這一點?

TY

+0

你可以嘗試使用「佔位」 =>「您的文字...」直接attr的同一級別? – vibol

+0

如果我在attr – Aximem

回答

1

相同級別的你需要一個CKEditor的插件來做到這一點。

下載從http://ckeditor.com/addon/confighelper配置助手插件,並從zip文件到web解壓文件夾捆綁您的應用程序(web/bundles/confighelper/)的目錄。

加載插件在buildForm方法,並設置佔位符如下

->add('text', CKEditorType::class, array(
    'config' => array(
     'extraPlugins' => 'confighelper', 
     'placeholder' => 'Your text ...', 
    ), 
    'plugins' => array(
     'confighelper' => array(
      'path' => '/bundles/confighelper/', 
      'filename' => 'plugin.js', 
     ), 
    ) 
)) 
+0

它完美地工作。 TY Akash! – Aximem

0

佔位不留在裏面ATTR,但留ATTR

->add('text', CKEditorType::class, array(
    'placeholder' => 'Your text ...' 
)) 
+0

的相同級別使用它,則不存在選項「佔位符」我已經試過這個:「佔位符」選項不存在 – Aximem