Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Adding option drop-downs to pages

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

Page: 1
Go to End
Author Topic: 289 Views
  • Spaghetti
    Community Member
    31 Posts

    Adding option drop-downs to pages Link to this post

    I'm trying to figure out how to add an option on my CMS editor page, sidebar content. So far I've done this:

    function getCMSFields()
    $fields = parent::getCMSFields();
           new HTMLEditorField('SideContent','Sidebar content'));
           new OptionsetField(
           $title = 'Show social widgets on this page',
           $source = array(
              '1' => 'show','2' => 'hide'),
    return $fields;

    In my page controller, which shows the controls but doesn't save their state when I click save. What am I missing?

  • novaweb
    Community Member
    115 Posts

    Re: Adding option drop-downs to pages Link to this post

    You probably need to declare:

    static $db = array(); or a $has_one or $has_many relationship titled 'ShowSocial'

    Else you are giving the program the interface to do what you want, but you're not giving it anywhere to be saved.


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.