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.

We've moved the forum!

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.

Archive /

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

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

Add a tab on the security cms section


Go to End


5 Posts   3037 Views

Avatar
TuTToWeB

Community Member, 10 Posts

7 April 2008 at 10:04am

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.

Avatar
Ingo

Forum Moderator, 801 Posts

7 April 2008 at 7:18pm

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

Avatar
TuTToWeB

Community Member, 10 Posts

8 April 2008 at 3:54am

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.

Avatar
TuTToWeB

Community Member, 10 Posts

9 April 2008 at 3:46am

can someone help me?
Thank you

Avatar
Ingo

Forum Moderator, 801 Posts

9 April 2008 at 10:18pm

$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);