Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » ImageField & ImageDataObjectManager

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 1875 Views
  • Krille Brocket
    Avatar
    Community Member
    10 Posts

    ImageField & ImageDataObjectManager Link to this post

    Hi I runnng ss 2.4 and have a strange problem. I have a 1-many relation between a Gallery and a GalleryImage.
    Im using ImageDataObjectManager in the Gallery page and everything worked fine until I added an ImageField.

    The error im getting in firebug is:

    C[L][K] is not a constructor
    http://localhost/silverstripe/dataobject_manager/javascript/jquery-ui-1.6.js
    Line 10

    Here's some code:

    class Gallery extends Page {
    static $has_one = array(
    "Image" => "Image"
    };
    static $has_many = array(
    "GalleryImages" => "GalleryImage"
    };
          public function getCMSFields() {
             $fields = parent::getCMSFields();
             $imageField = new ImageField("Image","Image");
             $fields->addFieldToTab("Root.Content.Main",$imageField);
             $table = new ImageDataObjectManager(
                $this,
                "GalleryImages",
                "GalleryImage",
                "Image",
                array()
             );
          
             $fields->addFieldToTab("Root.Content.Images",$table);
             return $fields;
          }
    };

       class GalleryImage extends DataObject {
          static $has_one = array(
             "Image"=>"Image",
             "Gallery"=>"Gallery"
          );
       }

  • Krille Brocket
    Avatar
    Community Member
    10 Posts

    Re: ImageField & ImageDataObjectManager Link to this post

    The problem was a javascript being included in the Page_Controller.
    I Removed the Requirements::javascript statement and used the template tag <% require javascript %> and now everything works fine=)

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