mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 15:05:42 +00:00
MINOR: removed parent code
This commit is contained in:
parent
edb703d119
commit
0f21c475a6
@ -27,15 +27,8 @@ class EditableFileField extends EditableFormField {
|
|||||||
|
|
||||||
static $plural_names = 'File fields';
|
static $plural_names = 'File fields';
|
||||||
|
|
||||||
function getFormField() {
|
public function getFormField() {
|
||||||
if($field = parent::getFormField()) {
|
return new FileField($this->Name, $this->Title);
|
||||||
return $field;
|
|
||||||
}
|
|
||||||
return new FileField($this->Name, $this->Title, $this->getField('Default'));
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSimpleFormField(){
|
|
||||||
return new FileField($this->Name, $this->Title, $this->getField('Default'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
@ -6,36 +6,26 @@
|
|||||||
*/
|
*/
|
||||||
class EditableMemberListField extends EditableFormField {
|
class EditableMemberListField extends EditableFormField {
|
||||||
|
|
||||||
static $has_one = array(
|
|
||||||
'Group' => 'Group'
|
|
||||||
);
|
|
||||||
|
|
||||||
static $singular_name = 'Member list field';
|
static $singular_name = 'Member list field';
|
||||||
|
|
||||||
static $plural_name = 'Member list fields';
|
static $plural_name = 'Member list fields';
|
||||||
|
|
||||||
public function DefaultField() {
|
public function DefaultField() {
|
||||||
// return new TreeDropdownField( "Fields[{$this->ID}][GroupID]", 'Group' );
|
|
||||||
|
|
||||||
$groups = DataObject::get('Group');
|
$groups = DataObject::get('Group');
|
||||||
|
|
||||||
foreach( $groups as $group )
|
foreach( $groups as $group )
|
||||||
$groupArray[$group->ID] = $group->Title;
|
$groupArray[$group->ID] = $group->Title;
|
||||||
|
|
||||||
return new DropdownField( "Fields[{$this->ID}][GroupID]", 'Group', $groupArray, $this->GroupID );
|
return new DropdownField( "Fields[{$this->ID}][CustomSetting][GroupID]", 'Group', $groupArray, $this->getSetting('GroupID'));
|
||||||
}
|
|
||||||
|
|
||||||
public function populateFromPostData( $data ) {
|
|
||||||
$this->GroupID = $data['GroupID'];
|
|
||||||
|
|
||||||
parent::populateFromPostData( $data );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFormField() {
|
function getFormField() {
|
||||||
return new DropdownField( $this->Name, $this->Title, Member::mapInGroups( $this->GroupID ) );
|
return new DropdownField( $this->Name, $this->Title, Member::mapInGroups($this->getSetting($this->GroupID)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getValueFromData( $data ) {
|
function getValueFromData($data) {
|
||||||
$value = $data[$this->Name];
|
$value = Convert::raw2sql($data[$this->Name]);
|
||||||
|
|
||||||
$member = DataObject::get_one('Member', "Member.ID = {$value}");
|
$member = DataObject::get_one('Member', "Member.ID = {$value}");
|
||||||
return $member->getName();
|
return $member->getName();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user