Jump to:

22979 Posts in 11815 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » I can't handle sub-URLs of a Form object. with subsites module

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 566 Views
  • Fraser
    Avatar
    Community Member
    46 Posts

    I can't handle sub-URLs of a Form object. with subsites module Link to this post

    Bit of a long shot but can anyone shed any light on this?

    I have recently installed the subsites module to run multiple sites from a single installation and am now getting the error: "I can't handle sub-URLs of a Form object." when I try to add descriptions/titles to image gallery objects. I have removed the subsites to verify that it is this which is causing the issue. I am using 2.4

    I can upload images fine, however it is when trying to save a description from the popup that the issue arises.

    I have tried with the default fields too and this still gives the same error.

    My code:

    <?php

    class Gallery extends Page {

       public static $db = array(
          'SummaryText'=>'Text',
          'GalleryText'=>'Text'
       );
       
       static $has_many = array(
          'Photos' => 'GalleryPhoto'
       );
       
       function getCMSFields() {
          $fields = parent::getCMSFields();
          
          
          $manager = new ImageDataObjectManager(
             $this, // Controller
             'Photos', // Source name
             'GalleryPhoto', // Source class
             'Image' // File name on DataObject
          );
          $manager->uploadFolder = $this->URLSegment;
          
          
          $fields->addFieldToTab('Root.Content.Main', new TextField('SummaryText', 'Summary Text (Appears in the section preview)'), 'Content');
          $fields->addFieldToTab('Root.Content.Main', new TextField('GalleryText', 'Gallery Text (entering anything in here will overwrite any image Titles and Descriptions)'), 'Content');
          $fields->addFieldsToTab("Root.Content.Gallery", array($manager));            
          $fields->removeFieldFromTab('Root.Content', 'StyledText');
          $fields->removeFieldFromTab('Root.Content', 'Column2');
          $fields->removeFieldFromTab('Root.Content', 'Content');
          
          
          return $fields;
          
       }
       
       
    }

    <?php

    class GalleryPhoto extends Photo {

       public static $db = array(
          'HTMLDescription'=>'HTMLText'
       );
       
       static $has_one = array(
          'Gallery' => 'Gallery'
       );
       
       public function getCMSFields(){
          $fields = parent::getCMSFields();
          $fields->removebyname('Description');
          $fields->removebyname('Title');
          $fields->replaceField('HTMLDescription', new SimpleTinyMCEField('HTMLDescription'));
          return $fields;
       }
    }

  • _Matt
    Avatar
    Community Member
    24 Posts

    Re: I can't handle sub-URLs of a Form object. with subsites module Link to this post

    I'm having the same issue.

    I'm also using the subsites module and I have a pagetype that has a tab with images in a gridfield.

    Sometimes I can create a new image record in the gridfield ok, but when I try to reload the record I get a 404 page not found error. Other times I get a little popup message saying "Not found" - In either case if I refresh I just get a blank page with the message "I can't handle sub-URLs of a Form object", but I have no idea what that means.

    Can anyone suggest anything?

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