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   2217 Views

Avatar
jdi

2 December 2009 at 12:48pm Community Member, 34 Posts

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

2 December 2009 at 8:34pm Community Member, 901 Posts

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

4 December 2009 at 11:12am Community Member, 34 Posts

Hey Banal.

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

Avatar
Mauro74

16 July 2012 at 10:03pm (Last edited: 16 July 2012 10:03pm), Community Member, 30 Posts

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

17 July 2012 at 3:02am Forum Moderator, 1091 Posts

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

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

Avatar
swaiba

17 July 2012 at 4:46am Forum Moderator, 1796 Posts

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