Jump to:

1976 Posts in 1306 Topics by 607 members

Form Questions

SilverStripe Forums » Form Questions » Limit Characters Displayed in ComplexTableField

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

Page: 1
Go to End
Author Topic: 454 Views
  • Marko
    Avatar
    Community Member
    2 Posts

    Limit Characters Displayed in ComplexTableField Link to this post

    Hi, I'd like to limit the number of characters that are displayed in a ComplexTableField (in CMS) while keeping the underlying data in tact for display in the popup. Any thoughts?

  • martimiz
    Avatar
    Forum Moderator
    1038 Posts

    Re: Limit Characters Displayed in ComplexTableField Link to this post

    One simple way to do is to create a function in your DataObject that returns the truncated text, then add the name of that function to the summary fields, like

    static $summary_fields = array(
       'Name',
       'Title',
       'TruncatedCondent'
    );

    function TruncatedContent() {
       // return $this->Content, truncated in some way
    }

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