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?
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
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?
Yeah, you can do it that way..
foreach($fields as $field) {
if($field->class == "DataObjectManager") {
$field->setPermissions(array());
break;
}
}
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
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