7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Inherited pages -- sub-class does not save the right Page ID
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 771 Views |
-
Inherited pages -- sub-class does not save the right Page ID

13 November 2009 at 6:22pm
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
-
Re: Inherited pages -- sub-class does not save the right Page ID

14 November 2009 at 3:04am
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.
-
Re: Inherited pages -- sub-class does not save the right Page ID

14 November 2009 at 3:08am
Thank you! I knew what the problem was, just couldn't find the function name.
-
Re: Inherited pages -- sub-class does not save the right Page ID

16 November 2009 at 6:04pm
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
-
Re: Inherited pages -- sub-class does not save the right Page ID

16 November 2009 at 6:17pm
That looks right to me. What's not working?
-
Re: Inherited pages -- sub-class does not save the right Page ID

17 November 2009 at 1:55am
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
-
Re: Inherited pages -- sub-class does not save the right Page ID

17 November 2009 at 2:07am
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.
| 771 Views | ||
|
Page:
1
|
Go to Top |

