Jump to:

3432 Posts in 1058 Topics by 734 members

Data Model Questions

SilverStripe Forums » Data Model Questions » HTMLText not displaying as HTMLField

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

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

    HTMLText not displaying as HTMLField Link to this post

    Hi

    I have a problem with a HTMLText data type being displayed in a text field instead of a editable html field. The problem only occurs when the field is being displayed in a pop-up field.

    Any ideas on what might be causing this issue? I've posted the code used to re-create the problem below.

    class TestAdminTree extends ModelAdmin
    {
    static $managed_models = array('TreeParentObject');

    static $url_segment = 'testtreeadmin';
    static $menu_title = 'TestTree Admin';
    }

    class TreeParentObject extends DataObject
    {
    static $db = array('Name' => 'Text');

    static $has_many = array('TreeChildObject' => 'TreeChildObject');
    }

    class TreeChildObject extends DataObject
    {
    static $db = array('HT' => 'HTMLText');

    static $has_one = array('TreeParentObject' => 'TreeParentObject');
    }

    Thanks
    phil

  • Bauer-CTU
    Avatar
    Community Member
    10 Posts

    Re: HTMLText not displaying as HTMLField Link to this post

    Not sure I've understood this correctly Phil - can you post your code for function getCMSFields() ?

  • swaiba
    Avatar
    Forum Moderator
    1785 Posts

    Re: HTMLText not displaying as HTMLField Link to this post

    Hi Bauer,

    FYI the field is automatically scaffolded into a HTMLField (as you can see if you add TreeChildObject to the managed models)... so there is no need to override the getCMSFields to reproduce this...

    static $managed_models = array('TreeParentObject','TreeChildObject');

  • Bauer-CTU
    Avatar
    Community Member
    10 Posts

    Re: HTMLText not displaying as HTMLField Link to this post

    Oh ok. Thanks for the info swaiba. I'm a bit of a SS newbie.

  • swaiba
    Avatar
    Forum Moderator
    1785 Posts

    Re: HTMLText not displaying as HTMLField Link to this post

    No worries, I'm just interested in an answer here also!

  • swaiba
    Avatar
    Forum Moderator
    1785 Posts

    Re: HTMLText not displaying as HTMLField Link to this post

    I know CTF is going to die soon, but please can anyone help with a solution to using TinyMCE in a CTF has_one / has_many popup please?
    (see attached image if there is any confusion)

    Attached Files
  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: HTMLText not displaying as HTMLField Link to this post

    are you using this within an ComplexTableField?

    if so I think the best might be specify the popUpFiled types for the table field.

    new ComplexTableField($this, $name, $sourceClass, $fieldList = null, $detailFormFields = new FieldSet( new TextField('HT'); ) )

    this might work, and if you still need a WYSIWYG editor on the popup you can use some of the goodies which ships with the DataObjectManagerModule of unclecheese

    1708 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.