Jump to:

7937 Posts in 1537 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Format Time.Nice (in the CMS)?

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 1387 Views
  • socks
    Avatar
    Community Member
    190 Posts

    Format Time.Nice (in the CMS)? Link to this post

    I have it working on the front-end, but didn't know if it was possible to format a field as Time.Nice within DOM in the CMS.

    thanks,
    Clint

  • UncleCheese
    Avatar
    4085 Posts

    Re: Format Time.Nice (in the CMS)? Link to this post

    Just use a custom getter.

    public function getNiceTime() {
    return $this->obj('YourTimeField')->Nice();
    }

    and in your summary fields:

    'NiceTime' => 'Time'

  • socks
    Avatar
    Community Member
    190 Posts

    Re: Format Time.Nice (in the CMS)? Link to this post

    I got that to work, thanks Uncle Cheese.

    Is it supposed to work in the Popup as well? I was getting a blank field when going back into the Popup to edit. Not that big of a deal if it doesn't.

    thanks again,
    Clint

  • UncleCheese
    Avatar
    4085 Posts

    Re: Format Time.Nice (in the CMS)? Link to this post

    No, the popup is configured by your getCMSFields() function, not $summary_fields.

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