View more context

 

null

SilverStripe\CMS\Model\RedirectorPage

SilentDesigns

Do you mean I need to add a use statement to include the RedirectorPage?

thats4shaw

And it will be RedirectorPage::class in your allowed_children array.

👍 (1)
thats4shaw

I don’t think it works otherwise but I could be wrong.

SilentDesigns

I have a boolean value on a custom page that I am trying to set and unset via a checkbox. The boolean value is set to '1' as expected when I check the box in the CMS and publish the page, but when I uncheck the box and re-publish the page, it is not set back to '0' and remains at '1'. This is my code:


    ...

        private static $db = [
            'isRecent' => 'Boolean',
          ...
  public function getCMSFields() {
            $fields = parent::getCMSFields();
            $conf = GridFieldConfig_RelationEditor::create(10);
            $conf->addComponent(new GridFieldSortableRows('SortOrder'));
            $fields->addFieldToTab('Root.Main', new GridField('ProjectImages', 'Slideshow (2880px x 1254px)', $this->ProjectImages(), $conf), 'Content');
            $thumbnail = UploadField::create('Thumbnail', 'Thumbnail')->setDescription('Photo for Project Summary (on landing page) 360x265px');
            $fields->addFieldToTab("Root.Main", TextField::create('Location','Location'), 'Content');
            $fields->addFieldToTab('Root.Main', CheckboxField::create('isCurrent', 'Current Project?','Content'));
            $fields->addFieldToTab('Root.Main', CheckboxField::create('isRecent', 'Recent Project?','Content'));
SilentDesigns

SilentDesigns [4:35 PM] I have a boolean value on a custom page that I am trying to set and unset via a checkbox. The boolean value is set to '1' as expected when I check the box in the CMS and publish the page, but when I uncheck the box and re-publish the page, it is not set back to '0' and remains at '1'. This is my code:

  1. class ProjectPage extends Page
  2. ...
  3.  
  4. private static $db = [
  5. 'isRecent' => 'Boolean',
  6. ...
  7.  
  8. public function getCMSFields() {
  9. $fields->addFieldToTab('Root.Main', CheckboxField::create('isRecent', 'Recent Project?','Content'));
  10. ...
SilentDesigns

And I can see the value when using $isRecent in the page template