silverstripe-userforms/code/model/editableformfields/EditableOption.php

56 lines
993 B
PHP
Raw Normal View History

<?php
/**
2015-09-11 00:20:06 +02:00
* Base Class for EditableOption Fields such as the ones used in
* dropdown fields and in radio check box groups
2015-09-11 00:20:06 +02:00
*
* @package userforms
*/
class EditableOption extends DataObject {
2015-09-11 00:20:06 +02:00
private static $default_sort = "Sort";
private static $db = array(
"Name" => "Varchar(255)",
"Title" => "Varchar(255)",
"Default" => "Boolean",
"Sort" => "Int"
);
2015-09-11 00:20:06 +02:00
private static $has_one = array(
"Parent" => "EditableMultipleOptionField",
);
2015-09-11 00:20:06 +02:00
private static $extensions = array(
"Versioned('Stage', 'Live')"
);
2015-07-24 04:37:48 +02:00
private static $summary_fields = array(
'Title',
'Default'
);
/**
* @param Member $member
*
* @return boolean
*/
public function canEdit($member = null) {
return ($this->Parent()->canEdit($member));
}
2015-07-24 04:37:48 +02:00
/**
* @param Member $member
*
* @return boolean
*/
public function canDelete($member = null) {
return ($this->Parent()->canDelete($member));
}
2015-07-24 04:37:48 +02:00
public function getEscapedTitle() {
return Convert::raw2att($this->Title);
}
}