mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
API Move templates to namespaced class locations in the templates folder
This commit is contained in:
parent
cdb2259307
commit
cba7c26950
@ -165,7 +165,9 @@ class EditableCustomRule extends DataObject
|
||||
|
||||
/**
|
||||
* Substitutes configured rule logic with it's JS equivalents and returns them as array elements
|
||||
*
|
||||
* @return array
|
||||
* @throws LogicException If the provided condition option was not able to be handled
|
||||
*/
|
||||
public function buildExpression()
|
||||
{
|
||||
|
@ -45,8 +45,8 @@ class EditableCheckbox extends EditableFormField
|
||||
public function getFormField()
|
||||
{
|
||||
$field = CheckboxField::create($this->Name, $this->EscapedTitle, $this->CheckedDefault)
|
||||
->setFieldHolderTemplate('UserFormsCheckboxField_holder')
|
||||
->setTemplate('UserFormsCheckboxField');
|
||||
->setFieldHolderTemplate(__CLASS__ . '_holder')
|
||||
->setTemplate(__CLASS__);
|
||||
|
||||
$this->doUpdateFormField($field);
|
||||
|
||||
|
@ -26,8 +26,8 @@ class EditableCheckboxGroupField extends EditableMultipleOptionField
|
||||
public function getFormField()
|
||||
{
|
||||
$field = UserFormsCheckboxSetField::create($this->Name, $this->EscapedTitle, $this->getOptionsMap());
|
||||
$field->setFieldHolderTemplate('UserFormsMultipleOptionField_holder');
|
||||
$field->setTemplate('UserFormsCheckboxSetField');
|
||||
$field->setFieldHolderTemplate(EditableMultipleOptionField::class . '_holder');
|
||||
$field->setTemplate('UserFormsCheckboxSetField'); // @todo
|
||||
|
||||
// Set the default checked items
|
||||
$defaultCheckedItems = $this->getDefaultOptions();
|
||||
|
@ -6,6 +6,7 @@ use SilverStripe\Core\Manifest\ModuleLoader;
|
||||
use SilverStripe\Forms\DropdownField;
|
||||
use SilverStripe\i18n\i18n;
|
||||
use SilverStripe\UserForms\Model\EditableCustomRule;
|
||||
use SilverStripe\UserForms\Model\EditableDropdownField;
|
||||
use SilverStripe\UserForms\Model\EditableFormField;
|
||||
|
||||
/**
|
||||
@ -38,7 +39,7 @@ class EditableCountryDropdownField extends EditableFormField
|
||||
$field = DropdownField::create($this->Name, $this->EscapedTitle)
|
||||
->setSource(i18n::getData()->getCountries())
|
||||
->setFieldHolderTemplate('UserFormsField_holder')
|
||||
->setTemplate('UserFormsDropdownField');
|
||||
->setTemplate(EditableDropdownField::class);
|
||||
|
||||
$this->doUpdateFormField($field);
|
||||
|
||||
|
@ -60,7 +60,7 @@ class EditableDateField extends EditableFormField
|
||||
|
||||
$field = FormField::create($this->Name, $this->EscapedTitle, $defaultValue)
|
||||
->setFieldHolderTemplate('UserFormsField_holder')
|
||||
->setTemplate('UserFormsField');
|
||||
->setTemplate(EditableFormField::class);
|
||||
|
||||
$this->doUpdateFormField($field);
|
||||
|
||||
|
@ -60,8 +60,8 @@ class EditableDropdown extends EditableMultipleOptionField
|
||||
public function getFormField()
|
||||
{
|
||||
$field = DropdownField::create($this->Name, $this->EscapedTitle, $this->getOptionsMap())
|
||||
->setFieldHolderTemplate('UserFormsField_holder')
|
||||
->setTemplate('UserFormsDropdownField');
|
||||
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||
->setTemplate(__CLASS__);
|
||||
|
||||
if ($this->UseEmptyString) {
|
||||
$field->setEmptyString(($this->EmptyString) ? $this->EmptyString : '');
|
||||
|
@ -32,7 +32,7 @@ class EditableEmailField extends EditableFormField
|
||||
{
|
||||
$field = EmailField::create($this->Name, $this->EscapedTitle, $this->Default)
|
||||
->setFieldHolderTemplate('UserFormsField_holder')
|
||||
->setTemplate('UserFormsField');
|
||||
->setTemplate(EditableFormField::class);
|
||||
|
||||
$this->doUpdateFormField($field);
|
||||
|
||||
|
@ -99,10 +99,10 @@ class EditableFileField extends EditableFormField
|
||||
{
|
||||
$field = FileField::create($this->Name, $this->EscapedTitle)
|
||||
->setFieldHolderTemplate('UserFormsField_holder')
|
||||
->setTemplate('UserFormsFileField');
|
||||
->setTemplate(__CLASS__);
|
||||
|
||||
$field->setFieldHolderTemplate('UserFormsField_holder')
|
||||
->setTemplate('UserFormsFileField');
|
||||
->setTemplate(__CLASS__);
|
||||
|
||||
$field->getValidator()->setAllowedExtensions(
|
||||
array_diff(
|
||||
|
@ -145,7 +145,7 @@ class EditableLiteralField extends EditableFormField
|
||||
$field = CompositeField::create($content)
|
||||
->setName($this->Name)
|
||||
// ->setID($this->Name) // @todo
|
||||
->setFieldHolderTemplate('UserFormsLiteralField_holder');
|
||||
->setFieldHolderTemplate(__CLASS__ . '_holder');
|
||||
|
||||
$this->doUpdateFormField($field);
|
||||
|
||||
|
@ -113,9 +113,9 @@ class EditableMultipleOptionField extends EditableFormField
|
||||
* @param string $toStage
|
||||
* @param bool $createNewVersion
|
||||
*/
|
||||
public function doPublish($fromStage, $toStage, $createNewVersion = false)
|
||||
public function copyVersionToStage($fromStage, $toStage, $createNewVersion = false)
|
||||
{
|
||||
parent::doPublish($fromStage, $toStage, $createNewVersion);
|
||||
parent::copyVersionToStage($fromStage, $toStage, $createNewVersion);
|
||||
$this->publishOptions($fromStage, $toStage, $createNewVersion);
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ class EditableMultipleOptionField extends EditableFormField
|
||||
// Publish all options
|
||||
foreach ($this->Options() as $option) {
|
||||
$seenIDs[] = $option->ID;
|
||||
$option->publish($fromStage, $toStage, $createNewVersion);
|
||||
$option->copyVersionToStage($fromStage, $toStage, $createNewVersion);
|
||||
}
|
||||
|
||||
// remove any orphans from the "fromStage"
|
||||
|
@ -42,8 +42,8 @@ class EditableNumericField extends EditableFormField
|
||||
public function getFormField()
|
||||
{
|
||||
$field = NumericField::create($this->Name, $this->EscapedTitle, $this->Default)
|
||||
->setFieldHolderTemplate('UserFormsField_holder')
|
||||
->setTemplate('UserFormsField')
|
||||
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||
->setTemplate(EditableFormField::class)
|
||||
->addExtraClass('number');
|
||||
|
||||
$this->doUpdateFormField($field);
|
||||
|
@ -36,8 +36,8 @@ class EditableRadioField extends EditableMultipleOptionField
|
||||
public function getFormField()
|
||||
{
|
||||
$field = OptionsetField::create($this->Name, $this->EscapedTitle, $this->getOptionsMap())
|
||||
->setFieldHolderTemplate('UserFormsMultipleOptionField_holder')
|
||||
->setTemplate('UserFormsOptionSetField');
|
||||
->setFieldHolderTemplate(EditableMultipleOptionField::class . '_holder')
|
||||
->setTemplate('UserFormsOptionSetField'); // @todo
|
||||
|
||||
// Set default item
|
||||
$defaultOption = $this->getDefaultOptions()->first();
|
||||
|
@ -129,13 +129,13 @@ class EditableTextField extends EditableFormField
|
||||
{
|
||||
if ($this->Rows > 1) {
|
||||
$field = TextareaField::create($this->Name, $this->EscapedTitle, $this->Default)
|
||||
->setFieldHolderTemplate('UserFormsField_holder')
|
||||
->setTemplate('UserFormsTextareaField')
|
||||
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||
->setTemplate(str_replace('EditableTextField', 'EditableTextareaField', __CLASS__))
|
||||
->setRows($this->Rows);
|
||||
} else {
|
||||
$field = TextField::create($this->Name, $this->EscapedTitle, $this->Default)
|
||||
->setFieldHolderTemplate('UserFormsField_holder')
|
||||
->setTemplate('UserFormsField');
|
||||
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||
->setTemplate(EditableFormField::class);
|
||||
}
|
||||
|
||||
$this->doUpdateFormField($field);
|
||||
|
@ -31,7 +31,7 @@ class SubmittedFormField extends DataObject
|
||||
|
||||
/**
|
||||
* @param Member $member
|
||||
*
|
||||
* @param array $context
|
||||
* @return boolean
|
||||
*/
|
||||
public function canCreate($member = null, $context = [])
|
||||
|
@ -433,7 +433,7 @@ JS
|
||||
$this->extend('updateReceivedFormSubmissionData', $data);
|
||||
|
||||
return $this->customise([
|
||||
'Content' => $this->customise($data)->renderWith('ReceivedFormSubmission'),
|
||||
'Content' => $this->customise($data)->renderWith(__CLASS__ . '_ReceivedFormSubmission'),
|
||||
'Form' => '',
|
||||
]);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<form $AttributesHTML>
|
||||
|
||||
<% include UserFormProgress %>
|
||||
<% include UserFormStepErrors %>
|
||||
<% include SilverStripe\\UserForms\\Form\\UserFormProgress %>
|
||||
<% include SilverStripe\\UserForms\\Form\\UserFormStepErrors %>
|
||||
|
||||
<% if $Message %>
|
||||
<p id="{$FormName}_error" class="message $MessageType">$Message</p>
|
||||
@ -21,9 +21,9 @@
|
||||
<% end_if %>
|
||||
|
||||
<% if $Steps.Count > 1 %>
|
||||
<% include UserFormStepNav %>
|
||||
<% include SilverStripe\\UserForms\\Form\\UserFormStepNav %>
|
||||
<% else %>
|
||||
<% include UserFormActionNav %>
|
||||
<% include SilverStripe\\UserForms\\Form\\UserFormActionNav %>
|
||||
<% end_if %>
|
||||
|
||||
</form>
|
@ -2,7 +2,7 @@
|
||||
<% if $Tag == 'fieldset' && $Legend %>
|
||||
<legend>$Legend</legend>
|
||||
<% end_if %>
|
||||
|
||||
|
||||
<div class="middleColumn">
|
||||
<% loop $FieldList %>
|
||||
<% if $ColumnCount %>
|
Loading…
Reference in New Issue
Block a user