I know this has been discussed before, but cannot find it for the life of me!
I have ImageDataObjectManager working on Pages but the "PageID" does not get set when upload a new image in the sub-class pages.
Any help would be great!
Jeremy
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba
I know this has been discussed before, but cannot find it for the life of me!
I have ImageDataObjectManager working on Pages but the "PageID" does not get set when upload a new image in the sub-class pages.
Any help would be great!
Jeremy
You have to use setParentClass("ParentClass");
The problem is that the DOM gets passed $this as the controller, so on subclasses, it gets passed an object that does not have the foreign key, so you need to be explicit. Same is true for CTFs.
Thank you! I knew what the problem was, just couldn't find the function name.
I am having a difficult time getting this to work -- I assume that this command should be run in the "getCMSFields" method. What I am missing?
Here is a sample of what I have in code/Page.php:
function getCMSFields()
{
$fields = parent::getCMSFields();
$manager = new ImageDataObjectManager(
....
$manager->setParentClass('Page');
$fields->addFieldToTab("Root.Content.FeaturedPhotos", $manager);
return $fields;
}
Thank you!
Jeremy
That looks right to me. What's not working?
Dang, I feel so stupid. I was using an old(er) version of DOM.
But I do have a little problem now - when clicking "Add New ...." or when clicking to edit an existing image, the pop-up doesn't open. Instead the form takes over the whole page.
I tried it 325 and 323 with the same results, and on Firefox and Safari. There were no JS errors in the Firefox Error Console.
What am I doing wrong now? :-)
Jeremy
Some kind of javascript error. I would check Firebug. Make sure the directory for the module is named "dataobject_manager" and not "dataobject_manager_r123" or whatever Silverstripe names it. That path has to be correct to get the JS assets.