mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Moving NoHTML function from Text to StringField
This change will make the NoHTML function available for Varchar fields in particular.
This commit is contained in:
parent
a77ca1995a
commit
d5361dedec
@ -21,6 +21,7 @@ abstract class StringField extends DBField {
|
|||||||
'LimitWordCountXML' => 'HTMLText',
|
'LimitWordCountXML' => 'HTMLText',
|
||||||
"LowerCase" => "Text",
|
"LowerCase" => "Text",
|
||||||
"UpperCase" => "Text",
|
"UpperCase" => "Text",
|
||||||
|
'NoHTML' => 'Text',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -187,4 +188,13 @@ abstract class StringField extends DBField {
|
|||||||
public function UpperCase() {
|
public function UpperCase() {
|
||||||
return mb_strtoupper($this->value);
|
return mb_strtoupper($this->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the value of the field stripped of html tags.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function NoHTML() {
|
||||||
|
return strip_tags($this->value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ class Text extends StringField {
|
|||||||
'EscapeXML' => 'Text',
|
'EscapeXML' => 'Text',
|
||||||
'LimitWordCount' => 'Text',
|
'LimitWordCount' => 'Text',
|
||||||
'LimitWordCountXML' => 'HTMLText',
|
'LimitWordCountXML' => 'HTMLText',
|
||||||
'NoHTML' => 'Text',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,15 +51,6 @@ class Text extends StringField {
|
|||||||
|
|
||||||
DB::requireField($this->tableName, $this->name, $values, $this->default);
|
DB::requireField($this->tableName, $this->name, $values, $this->default);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the value of the field stripped of html tags.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function NoHTML() {
|
|
||||||
return strip_tags($this->value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value of the field with relative links converted to absolute urls.
|
* Return the value of the field with relative links converted to absolute urls.
|
||||||
|
Loading…
Reference in New Issue
Block a user