Jump to:

23013 Posts in 11540 Topics by 2825 members

General Questions

SilverStripe Forums » General Questions » HTMLEditorField in CTF Pop-up

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1021 Views
  • Phill
    Avatar
    Community Member
    75 Posts

    HTMLEditorField in CTF Pop-up Link to this post

    Hey

    I'm trying to find out if its possible to have a HTMLEditorField in a CTF Pop-up because I'm currently having an issue where a HTMLEditorField is being converted to a Text field.

    I've tried a search on this and found a topic in the archive with a similar problem [url=http://silverstripe.org/archive/show/1760]http://silverstripe.org/archive/show/1760

    where Ingo says

    "HTMLEditorField in CTF popup - don't go there, its a world of pain ;) seriously, there's too many optimizations specific to the main CMS UI to make this generically work on the popup."

    is this still the case?

    Thanks
    Phil

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: HTMLEditorField in CTF Pop-up Link to this post

    Yes, I am curious about this too, maybe there is a way of having a non-tinymce in a popup that someone has done instead?

  • prawnstar
    Avatar
    Community Member
    116 Posts

    Re: HTMLEditorField in CTF Pop-up Link to this post

    Hi, Phill,

    Sadly, I think this is still the case.

    It's not full featured, but if you use Uncle Cheese's DataObjects Manager module you should be able to use SimpleHTMLEditorField instead of the standard CTF HTMLEditorField. Again, it's not as full featured, but generally it gets the job done (it does have an html view).

    Otherwise the 'workaround' for this, if you need a full fledged editor, is to make pages instead of DataObjects. I.e., "MyClass extends Page" instead of "MyClass extends DataObject."

    In your page controller that you want that class to be included in, call that class like:

    public function MyFunction() {
       return DataObject::get_one("MyClass");
    }

    Then in your template.ss file:

    <% if MyFunction %>
       <% control MyFunction %>
    $SomeVariableFromYourClass
       <% end_control %>
    <% end_if %>

    Chris.b

    1021 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.