mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Defined $schemaDataType constant, added to FormField subclasses
This commit is contained in:
parent
3862a7a0a7
commit
55f12939bb
@ -7,6 +7,8 @@
|
|||||||
*/
|
*/
|
||||||
class CheckboxField extends FormField {
|
class CheckboxField extends FormField {
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_SINGLESELECT;
|
||||||
|
|
||||||
public function setValue($value) {
|
public function setValue($value) {
|
||||||
$this->value = ($value) ? 1 : 0;
|
$this->value = ($value) ? 1 : 0;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
*/
|
*/
|
||||||
class CheckboxSetField extends MultiSelectField {
|
class CheckboxSetField extends MultiSelectField {
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_MULTISELECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Explain different source data that can be used with this field,
|
* @todo Explain different source data that can be used with this field,
|
||||||
* e.g. SQLMap, ArrayList or an array.
|
* e.g. SQLMap, ArrayList or an array.
|
||||||
|
@ -43,6 +43,8 @@ class CompositeField extends FormField {
|
|||||||
*/
|
*/
|
||||||
protected $legend;
|
protected $legend;
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_STRUCTURAL;
|
||||||
|
|
||||||
public function __construct($children = null) {
|
public function __construct($children = null) {
|
||||||
if($children instanceof FieldList) {
|
if($children instanceof FieldList) {
|
||||||
$this->children = $children;
|
$this->children = $children;
|
||||||
@ -394,4 +396,3 @@ class CompositeField extends FormField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +75,8 @@ class ConfirmedPasswordField extends FormField {
|
|||||||
*/
|
*/
|
||||||
public $children;
|
public $children;
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_STRUCTURAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param string $title
|
* @param string $title
|
||||||
|
@ -28,6 +28,8 @@ class CountryDropdownField extends DropdownField {
|
|||||||
|
|
||||||
protected $extraClasses = array('dropdown');
|
protected $extraClasses = array('dropdown');
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_SINGLESELECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the locale of the Member, or if we're not logged in or don't have a locale, use the default one
|
* Get the locale of the Member, or if we're not logged in or don't have a locale, use the default one
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -112,4 +112,3 @@ class CurrencyField_Disabled extends CurrencyField{
|
|||||||
. " name=\"".$this->name."\" value=\"".$valforInput."\" />";
|
. " name=\"".$this->name."\" value=\"".$valforInput."\" />";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,8 @@ require_once 'Zend/Date.php';
|
|||||||
*/
|
*/
|
||||||
class DateField extends TextField {
|
class DateField extends TextField {
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_DATE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @config
|
* @config
|
||||||
* @var array
|
* @var array
|
||||||
@ -677,4 +679,3 @@ class DateField_View_JQuery extends Object {
|
|||||||
return preg_replace($patterns, $replacements, $format);
|
return preg_replace($patterns, $replacements, $format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,8 @@ class DatetimeField extends FormField {
|
|||||||
*/
|
*/
|
||||||
protected $timeField = null;
|
protected $timeField = null;
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_DATETIME;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @config
|
* @config
|
||||||
* @var array
|
* @var array
|
||||||
|
@ -29,6 +29,48 @@
|
|||||||
*/
|
*/
|
||||||
class FormField extends RequestHandler {
|
class FormField extends RequestHandler {
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_STRING = 'String';
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_HIDDEN = 'Hidden';
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_TEXT = 'Text';
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_HTML = 'HTML';
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_INTEGER = 'Integer';
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_DECIMAL = 'Decimal';
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_MULTISELECT = 'MultiSelect';
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_SINGLESELECT = 'SingleSelect';
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_DATE = 'Date';
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_DATETIME = 'DateTime';
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_TIME = 'Time';
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_BOOLEAN = 'Boolean';
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_CUSTOM = 'Custom';
|
||||||
|
|
||||||
|
/** @see $schemaDataType */
|
||||||
|
const SCHEMA_DATA_TYPE_STRUCTURAL = 'Structural';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Form
|
* @var Form
|
||||||
*/
|
*/
|
||||||
@ -170,7 +212,7 @@ class FormField extends RequestHandler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The data type backing the field. Represents the type of value the
|
* The data type backing the field. Represents the type of value the
|
||||||
* form expects to receive via a postback.
|
* form expects to receive via a postback. Should be set in subclasses.
|
||||||
*
|
*
|
||||||
* The values allowed in this list include:
|
* The values allowed in this list include:
|
||||||
*
|
*
|
||||||
@ -192,6 +234,8 @@ class FormField extends RequestHandler {
|
|||||||
* or simply be a block of stand-alone content. As with 'Custom',
|
* or simply be a block of stand-alone content. As with 'Custom',
|
||||||
* the component property is mandatory if this is assigned.
|
* the component property is mandatory if this is assigned.
|
||||||
*
|
*
|
||||||
|
* Each value has an equivalent constant, e.g. {@link self::SCHEMA_DATA_TYPE_STRING}.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $schemaDataType;
|
protected $schemaDataType;
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
* @subpackage fields-dataless
|
* @subpackage fields-dataless
|
||||||
*/
|
*/
|
||||||
class HiddenField extends FormField {
|
class HiddenField extends FormField {
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_HIDDEN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $properties
|
* @param array $properties
|
||||||
*
|
*
|
||||||
|
@ -15,6 +15,8 @@ use SilverStripe\Model\FieldType\DBMoney;
|
|||||||
*/
|
*/
|
||||||
class MoneyField extends FormField {
|
class MoneyField extends FormField {
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_TEXT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $_locale
|
* @var string $_locale
|
||||||
*/
|
*/
|
||||||
|
@ -15,6 +15,8 @@ abstract class MultiSelectField extends SelectField {
|
|||||||
*/
|
*/
|
||||||
protected $defaultItems = array();
|
protected $defaultItems = array();
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_MULTISELECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts the value of this field, normalised as an array.
|
* Extracts the value of this field, normalised as an array.
|
||||||
* Scalar values will return a single length array, even if empty
|
* Scalar values will return a single length array, even if empty
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
* @subpackage fields-formattedinput
|
* @subpackage fields-formattedinput
|
||||||
*/
|
*/
|
||||||
class NumericField extends TextField {
|
class NumericField extends TextField {
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_DECIMAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override locale for this field.
|
* Override locale for this field.
|
||||||
*
|
*
|
||||||
|
@ -23,6 +23,8 @@ abstract class SingleSelectField extends SelectField {
|
|||||||
*/
|
*/
|
||||||
protected $emptyString = '';
|
protected $emptyString = '';
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_SINGLESELECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param boolean $bool
|
* @param boolean $bool
|
||||||
* @return self Self reference
|
* @return self Self reference
|
||||||
|
@ -82,4 +82,3 @@ class Tab extends CompositeField {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@ class TextField extends FormField {
|
|||||||
*/
|
*/
|
||||||
protected $maxLength;
|
protected $maxLength;
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_TEXT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an input field.
|
* Returns an input field.
|
||||||
*
|
*
|
||||||
|
@ -50,6 +50,8 @@ class TimeField extends TextField {
|
|||||||
*/
|
*/
|
||||||
protected $valueObj = null;
|
protected $valueObj = null;
|
||||||
|
|
||||||
|
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_TIME;
|
||||||
|
|
||||||
public function __construct($name, $title = null, $value = ""){
|
public function __construct($name, $title = null, $value = ""){
|
||||||
if(!$this->locale) {
|
if(!$this->locale) {
|
||||||
$this->locale = i18n::get_locale();
|
$this->locale = i18n::get_locale();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user