For a blog/magazine style site with Posts organized into Categories.
Categories may only contain Posts as child pages.
Each Category would have one featured Post at any one time, selectable in the CMS.
So, in the Category class I have this:
static $allowed_children = array('Post');
static $has_one = array(
'FeaturedPost' => 'Post'
In the admin for a Category, I want to populate a dropdown with all of the Category's child Posts, and save the dropdown selection into FeaturedPost. Right now in getCMSFields with Category, I have this:
public function getCMSFields()
$fields = parent::getCMSFields();
$children = $this->Children();
$featured_field = new DropDownField('FeaturedPost', 'FeaturedPost', $children);
The DropDownField populates with the right number of Posts, but it doesn't save into the FeaturedPost relationship, or display the titles of the Posts.
Any help? Thanks in advance.