Hey everyone,
Hope everyone's doing great.
In the process of rapping up a project and I'am trying to overcome a little issue.
I need to add a few additional fields to the Security/Members section. I have gone as far as adding a test SID field with the code pasted below and now I'am trying to figure out how to populate the SID form field. Once an entry has been made.
So basically, if I enter in 1234 as the SID for Tom Brown, hit save and then click back on Tom Brown at a later date. The SID form field will populate with Tom's SID db entry (1234).
I have tried to look through the documentation, tried a bunch of random Google entries, tried looking for an entry on addFieldToTab and I haven't had much luck.
I found the code to extend the Security/Members in another thread (credit Zauberfisch) and it consists off (with a few modifications):
<?php
class SecurityMembersExtension extends DataObjectDecorator {
/**
* Define extra database fields
*
* Return an map where the keys are db, has_one, etc, and the values are
* additional fields/relations to be defined
*/
function extraMemberDetails() {
$fields = array(
'db' => array(
'SID' => 'Text'
),
'has_one' => array(
),
'defaults' => array(
'SID' => 'No SID entered'
)
);
return $fields;
}
function updateCMSFields(FieldSet &$fields) {
$fields->addFieldToTab('Root.Details', new TextField("SID", "SID"));
return $fields;
}
}
As always, any help is much appreciated.
Cheers,
- Evilish