mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
API Remove use of getEscapedTitle() and deprecated for future removal. Use $Title directly instead.
This commit is contained in:
parent
5b68e7bb58
commit
100be38ab1
@ -635,6 +635,8 @@ class EditableFormField extends DataObject
|
||||
/**
|
||||
* Returns the Title for rendering in the front-end (with XML values escaped)
|
||||
*
|
||||
* @deprecated 5.0..6.0 XML is automatically escaped in templates from SS 4 onwards. Please use $Title directly.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEscapedTitle()
|
||||
|
@ -44,7 +44,7 @@ class EditableCheckbox extends EditableFormField
|
||||
|
||||
public function getFormField()
|
||||
{
|
||||
$field = CheckboxField::create($this->Name, $this->EscapedTitle, $this->CheckedDefault)
|
||||
$field = CheckboxField::create($this->Name, $this->Title, $this->CheckedDefault)
|
||||
->setFieldHolderTemplate(__CLASS__ . '_holder')
|
||||
->setTemplate(__CLASS__);
|
||||
|
||||
|
@ -25,7 +25,7 @@ class EditableCheckboxGroupField extends EditableMultipleOptionField
|
||||
|
||||
public function getFormField()
|
||||
{
|
||||
$field = UserFormsCheckboxSetField::create($this->Name, $this->EscapedTitle, $this->getOptionsMap())
|
||||
$field = UserFormsCheckboxSetField::create($this->Name, $this->Title, $this->getOptionsMap())
|
||||
->setFieldHolderTemplate(EditableMultipleOptionField::class . '_holder')
|
||||
->setTemplate(UserFormsCheckboxSetField::class);
|
||||
|
||||
|
@ -35,7 +35,7 @@ class EditableCountryDropdownField extends EditableFormField
|
||||
|
||||
public function getFormField()
|
||||
{
|
||||
$field = DropdownField::create($this->Name, $this->EscapedTitle)
|
||||
$field = DropdownField::create($this->Name, $this->Title)
|
||||
->setSource(i18n::getData()->getCountries())
|
||||
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||
->setTemplate(EditableDropdown::class);
|
||||
|
@ -58,8 +58,8 @@ class EditableDateField extends EditableFormField
|
||||
? DBDatetime::now()->Format('Y-m-d')
|
||||
: $this->Default;
|
||||
|
||||
$field = FormField::create($this->Name, $this->EscapedTitle, $defaultValue)
|
||||
->setFieldHolderTemplate('UserFormsField_holder')
|
||||
$field = FormField::create($this->Name, $this->Title, $defaultValue)
|
||||
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||
->setTemplate(EditableFormField::class);
|
||||
|
||||
$this->doUpdateFormField($field);
|
||||
|
@ -60,7 +60,7 @@ class EditableDropdown extends EditableMultipleOptionField
|
||||
*/
|
||||
public function getFormField()
|
||||
{
|
||||
$field = DropdownField::create($this->Name, $this->EscapedTitle, $this->getOptionsMap())
|
||||
$field = DropdownField::create($this->Name, $this->Title, $this->getOptionsMap())
|
||||
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||
->setTemplate(__CLASS__);
|
||||
|
||||
|
@ -30,8 +30,8 @@ class EditableEmailField extends EditableFormField
|
||||
|
||||
public function getFormField()
|
||||
{
|
||||
$field = EmailField::create($this->Name, $this->EscapedTitle, $this->Default)
|
||||
->setFieldHolderTemplate('UserFormsField_holder')
|
||||
$field = EmailField::create($this->Name, $this->Title, $this->Default)
|
||||
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||
->setTemplate(EditableFormField::class);
|
||||
|
||||
$this->doUpdateFormField($field);
|
||||
|
@ -74,7 +74,7 @@ class EditableFieldGroup extends EditableFormField
|
||||
public function getFormField()
|
||||
{
|
||||
$field = UserFormsGroupField::create()
|
||||
->setTitle($this->EscapedTitle ?: false)
|
||||
->setTitle($this->Title ?: false)
|
||||
->setName($this->Name);
|
||||
$this->doUpdateFormField($field);
|
||||
return $field;
|
||||
|
@ -97,11 +97,11 @@ class EditableFileField extends EditableFormField
|
||||
|
||||
public function getFormField()
|
||||
{
|
||||
$field = FileField::create($this->Name, $this->EscapedTitle)
|
||||
->setFieldHolderTemplate('UserFormsField_holder')
|
||||
$field = FileField::create($this->Name, $this->Title)
|
||||
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||
->setTemplate(__CLASS__);
|
||||
|
||||
$field->setFieldHolderTemplate('UserFormsField_holder')
|
||||
$field->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||
->setTemplate(__CLASS__);
|
||||
|
||||
$field->getValidator()->setAllowedExtensions(
|
||||
|
@ -68,7 +68,7 @@ class EditableFormHeading extends EditableFormField
|
||||
|
||||
public function getFormField()
|
||||
{
|
||||
$labelField = HeaderField::create('userforms-header', $this->EscapedTitle)
|
||||
$labelField = HeaderField::create('userforms-header', $this->Title)
|
||||
->setHeadingLevel($this->Level);
|
||||
$labelField->addExtraClass('FormHeading');
|
||||
$labelField->setAttribute('data-id', $this->Name);
|
||||
@ -80,8 +80,7 @@ class EditableFormHeading extends EditableFormField
|
||||
{
|
||||
// set the right title on this field
|
||||
if ($this->RightTitle) {
|
||||
// Since this field expects raw html, safely escape the user data prior
|
||||
$field->setRightTitle(Convert::raw2xml($this->RightTitle));
|
||||
$field->setRightTitle($this->RightTitle);
|
||||
}
|
||||
|
||||
// if this field has an extra class
|
||||
|
@ -46,7 +46,7 @@ class EditableFormStep extends EditableFormField
|
||||
{
|
||||
$field = UserFormsStepField::create()
|
||||
->setName($this->Name)
|
||||
->setTitle($this->EscapedTitle);
|
||||
->setTitle($this->Title);
|
||||
$this->doUpdateFormField($field);
|
||||
return $field;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ class EditableMemberListField extends EditableFormField
|
||||
}
|
||||
|
||||
$members = Member::map_in_groups($this->GroupID);
|
||||
$field = DropdownField::create($this->Name, $this->EscapedTitle, $members);
|
||||
$field = DropdownField::create($this->Name, $this->Title, $members);
|
||||
$this->doUpdateFormField($field);
|
||||
return $field;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class EditableNumericField extends EditableFormField
|
||||
*/
|
||||
public function getFormField()
|
||||
{
|
||||
$field = NumericField::create($this->Name, $this->EscapedTitle, $this->Default)
|
||||
$field = NumericField::create($this->Name, $this->Title, $this->Default)
|
||||
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||
->setTemplate(EditableFormField::class)
|
||||
->addExtraClass('number');
|
||||
|
@ -2,11 +2,8 @@
|
||||
|
||||
namespace SilverStripe\UserForms\Model\EditableFormField;
|
||||
|
||||
use SilverStripe\CMS\Controllers\CMSMain;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\UserForms\Model\EditableFormField\EditableMultipleOptionField;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
|
||||
/**
|
||||
@ -66,12 +63,12 @@ class EditableOption extends DataObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 5.0 Use "$Title.XML" in templates instead
|
||||
* @deprecated 5.0..6.0 Use "$Title" in templates instead
|
||||
* @return string
|
||||
*/
|
||||
public function getEscapedTitle()
|
||||
{
|
||||
return Convert::raw2att($this->Title);
|
||||
return Convert::raw2xml($this->Title);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,7 +35,7 @@ class EditableRadioField extends EditableMultipleOptionField
|
||||
|
||||
public function getFormField()
|
||||
{
|
||||
$field = OptionsetField::create($this->Name, $this->EscapedTitle, $this->getOptionsMap())
|
||||
$field = OptionsetField::create($this->Name, $this->Title, $this->getOptionsMap())
|
||||
->setFieldHolderTemplate(EditableMultipleOptionField::class . '_holder')
|
||||
->setTemplate('SilverStripe\\UserForms\\FormField\\UserFormsOptionSetField');
|
||||
|
||||
|
@ -128,12 +128,12 @@ class EditableTextField extends EditableFormField
|
||||
public function getFormField()
|
||||
{
|
||||
if ($this->Rows > 1) {
|
||||
$field = TextareaField::create($this->Name, $this->EscapedTitle, $this->Default)
|
||||
$field = TextareaField::create($this->Name, $this->Title, $this->Default)
|
||||
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||
->setTemplate(str_replace('EditableTextField', 'EditableTextareaField', __CLASS__))
|
||||
->setRows($this->Rows);
|
||||
} else {
|
||||
$field = TextField::create($this->Name, $this->EscapedTitle, $this->Default)
|
||||
$field = TextField::create($this->Name, $this->Title, $this->Default)
|
||||
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||
->setTemplate(EditableFormField::class);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user