Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

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


Reply


2 Posts   695 Views

Avatar
Fraser

Community Member, 47 Posts

10 July 2012 at 3:55pm

Edited: 10/07/2012 4:00pm

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;
   }
}

Avatar
_Matt

Community Member, 28 Posts

30 April 2013 at 8:50am

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?