Jump to:

7938 Posts in 1541 Topics by 945 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » DataObjectManager: canCreate()

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2
Go to End
Author Topic: 1895 Views
  • EzraNaj
    Avatar
    Community Member
    11 Posts

    Re: DataObjectManager: canCreate() Link to this post

    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?

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager: canCreate() Link to this post

    Yeah, you can do it that way..

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

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: DataObjectManager: canCreate() Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager: canCreate() Link to this post

    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

    1895 Views
Page: 1 2
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.