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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

DataObjectManager: canCreate()


Go to End
Reply


12 Posts   2004 Views

Avatar
EzraNaj

Community Member, 11 Posts

26 August 2010 at 5:38pm

Hi UncleCheese,

Is this how I should I do it?
foreach( $fields as $field) {
....
}

I tried this but the page just froze. It might have looped over a huge set.

Btw, how do you find the DOM through looping the fields?

Avatar
UncleCheese

Forum Moderator, 4096 Posts

27 August 2010 at 1:29am

Yeah, you can do it that way..

foreach($fields as $field) {
if($field->class == "DataObjectManager") {
$field->setPermissions(array());
break;
}
}

Avatar
Carbon Crayon

Community Member, 598 Posts

8 September 2010 at 3:21am

I have come accross a similar issue before, I believe it is because (strangely) the Docorator fields are added before the standard class fields, so you can't manipulate them from the decorator. My issue arose when trying to specify the position of a decorated field in relation to a standard field, SS just didn't insert the new field as it couldn't find the one I was trying to position it above.

I gave up in the end, so I am not sure what the solution is to this problem is....it seems like it probably needs a core change in order to include decorated fields last.

Aram

Avatar
UncleCheese

Forum Moderator, 4096 Posts

8 September 2010 at 4:34am

That's really bizarre, because to my knowledge, the updateCMSFields() (or any extend() method, for that matter) is always the last thing a native function does. I've never seen it called from the top of the function.

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

Go to Top