Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Can I get TinyMCE to work as HTMLEditorField in ComplexTableField


Reply


6 Posts   2228 Views

Avatar
jdi

Community Member, 34 Posts

2 December 2009 at 12:48pm

Hey guys,

Hopefully this is pretty self explanatory. When I add an HTMLEditorField to my CMS fields when I'm creating a new ComplexTableField and editing it via a Popup, it doesnt add the tinyMCE wysiwyg?

Is this strange? Or am I unable to use the tinyMCE editor inside a ComplexTableField Popup?

public function getCMSFields() {
      $fields = parent::getCMSFields();

      HTMLEditorField::include_js();

      $fields->removeByName('Content');

      $fields->addFieldsToTab('Root.Content', new FieldSet(
         new HTMLEditorField('Content', 'Content')
      ));

      
      return $fields;

   }

   public function getCMSFields_forPopup() {
      return self::getCMSFields();   
   }

   public static function getCMSTableField($controller, $name) {
      
      $table = new ComplexTableField(
         $controller,
         $name,
         __CLASS__,
         null,
         'getCMSFields_forPopup',
         null,
         'Date DESC'
      );

...

Thanks for any help in advance :D

Avatar
banal

Community Member, 901 Posts

2 December 2009 at 8:34pm

Hi jdi

The HTMLEditorField doesn't work in popups. UncleCheese has several working WYSIWYG Editors bundled with his DataObjectManager module though:
http://doc.silverstripe.org/doku.php?id=simplewysiwygfield
http://doc.silverstripe.org/doku.php?id=simplehtmleditorfield
.. and also a SimpleTinyMCEField which uses TinyMCE as editor. The last one is the most recent addition and not (yet) on the doc wiki. I suggest you use the SimpleTinyMCEField, it seems to be the best of the three.

Avatar
jdi

Community Member, 34 Posts

4 December 2009 at 11:12am

Hey Banal.

Thanks a lot for the info, worked a treat. Much appreciated.

Avatar
Mauro74

Community Member, 30 Posts

16 July 2012 at 10:03pm

Edited: 16/07/2012 10:03pm

Guys I need the WYSIWYG working in the pop up, I found this post but the 2 links about Uncle Cheese solution are dead. Do you know where I can find these stuff?

Thanks!

Avatar
martimiz

Forum Moderator, 1098 Posts

17 July 2012 at 3:02am

They're part of the DataobjectManager module - look under code:

https://github.com/unclecheese/DataObjectManager/

Avatar
swaiba

Forum Moderator, 1798 Posts

17 July 2012 at 4:46am

Personally I'd advise just using the new SS3 - that doesn't use the "popup" stuff anymore...