Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Add a tab on the security cms section

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 2345 Views
  • TuTToWeB
    Avatar
    Community Member
    10 Posts

    Add a tab on the security cms section Link to this post

    Hi to everyone,
    i want to add a tab on the Security section, near Members and Pemissions tabs. I want insert inside that tab a form to edit an User-Defined DataObject. How to do that?
    Thanks to everyone.

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Add a tab on the security cms section Link to this post

    you'll have to subclass SecurityAdmin: http://doc.silverstripe.com/doku.php?id=leftandmain (customizing through addStaticVars()) and overload the getEditForm() method.

  • TuTToWeB
    Avatar
    Community Member
    10 Posts

    Re: Add a tab on the security cms section Link to this post

    Hi Ingo,
    thanks for you reply. I tried to do that you advice me, but it seemd don't work.

    This is my code:

    class CIFProfileForm extends SecurityAdmin
    {
    public function getEditForm($id)
    {
    $form = parent::getEditForm($id);

    $field = $form->Fields();

    $field->push(new Tab("Profili",new TextFiled("ciccio")));

    $field->setForm($form);
    return $form;
    }
    }

    and i add the follow line on the _config
    Object::useCustomClass("SecurityAdmin","CIFProfileForm");

    Do you have any ideas to fix it?
    Thank you very much.

  • TuTToWeB
    Avatar
    Community Member
    10 Posts

    Re: Add a tab on the security cms section Link to this post

    can someone help me?
    Thank you

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Add a tab on the security cms section Link to this post

    $myForm->Fields() will give you an object copy rather than reference, meaning that you don't actually alter the original formfields when pushing new stuff into it.

    $fields = $myForm->Fields();
    $fields->push(...);
    $myForm->setFields($fields);

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