mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
FIX Namespacing errors and method incompatibilities with parent classes
This commit is contained in:
parent
b8d6ac336f
commit
cd314d3a3c
@ -15,7 +15,7 @@ use SilverStripe\ORM\DataExtension;
|
|||||||
use SilverStripe\UserForms\Form\GridFieldAddClassesButton;
|
use SilverStripe\UserForms\Form\GridFieldAddClassesButton;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableTextField;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableTextField;
|
||||||
use SilverStripe\Versioned\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
@ -5,7 +5,7 @@ namespace SilverStripe\UserForms\Extension;
|
|||||||
use SilverStripe\Forms\RequiredFields;
|
use SilverStripe\Forms\RequiredFields;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
|
||||||
|
|
||||||
class UserFormValidator extends RequiredFields
|
class UserFormValidator extends RequiredFields
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace SilverStripe\UserForms\FormField;
|
namespace SilverStripe\UserForms\FormField;
|
||||||
|
|
||||||
use SilverStripe\Forms\CompositeField;
|
use SilverStripe\Forms\CompositeField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\UserForms\FormField;
|
namespace SilverStripe\UserForms\FormField;
|
||||||
|
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a field container which can iteratively process nested fields, converting it into a fieldset
|
* Represents a field container which can iteratively process nested fields, converting it into a fieldset
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace SilverStripe\UserForms\FormField;
|
namespace SilverStripe\UserForms\FormField;
|
||||||
|
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of formfields which allows for iterative processing of nested composite fields
|
* A list of formfields which allows for iterative processing of nested composite fields
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace SilverStripe\UserForms\FormField;
|
namespace SilverStripe\UserForms\FormField;
|
||||||
|
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Front end composite field for userforms
|
* Front end composite field for userforms
|
||||||
|
@ -7,7 +7,7 @@ use SilverStripe\CMS\Controllers\CMSMain;
|
|||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
use Silverstripe\Versioned\Versioned;
|
use Silverstripe\Versioned\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,7 +112,7 @@ class EditableCustomRule extends DataObject
|
|||||||
* @param array $context Virtual parameter to allow context to be passed in to check
|
* @param array $context Virtual parameter to allow context to be passed in to check
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function canCreate($member = null)
|
public function canCreate($member = null, $context = [])
|
||||||
{
|
{
|
||||||
// Check parent page
|
// Check parent page
|
||||||
$parent = $this->getCanCreateContext(func_get_args());
|
$parent = $this->getCanCreateContext(func_get_args());
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace SilverStripe\UserForms\Model\EditableFormField;
|
namespace SilverStripe\UserForms\Model;
|
||||||
|
|
||||||
use SilverStripe\CMS\Controllers\CMSMain;
|
use SilverStripe\CMS\Controllers\CMSMain;
|
||||||
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
||||||
@ -32,7 +32,6 @@ use SilverStripe\UserForms\Model\UserDefinedForm;
|
|||||||
use SilverStripe\UserForms\Model\EditableCustomRule;
|
use SilverStripe\UserForms\Model\EditableCustomRule;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFormStep;
|
||||||
use SilverStripe\UserForms\Model\Submission\SubmittedFormField;
|
use SilverStripe\UserForms\Model\Submission\SubmittedFormField;
|
||||||
use SilverStripe\UserForms\Modifier\DisambiguationSegmentFieldModifier;
|
use SilverStripe\UserForms\Modifier\DisambiguationSegmentFieldModifier;
|
||||||
@ -505,7 +504,7 @@ class EditableFormField extends DataObject
|
|||||||
* @param array $context Virtual parameter to allow context to be passed in to check
|
* @param array $context Virtual parameter to allow context to be passed in to check
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function canCreate($member = null)
|
public function canCreate($member = null, $context = [])
|
||||||
{
|
{
|
||||||
// Check parent page
|
// Check parent page
|
||||||
$parent = $this->getCanCreateContext(func_get_args());
|
$parent = $this->getCanCreateContext(func_get_args());
|
||||||
|
@ -4,6 +4,7 @@ namespace SilverStripe\UserForms\Model\EditableFormField;
|
|||||||
|
|
||||||
use CountryDropdownField; // @todo
|
use CountryDropdownField; // @todo
|
||||||
use SilverStripe\UserForms\Model\EditableCustomRule;
|
use SilverStripe\UserForms\Model\EditableCustomRule;
|
||||||
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dropdown field which allows the user to select a country
|
* A dropdown field which allows the user to select a country
|
||||||
|
@ -5,6 +5,7 @@ namespace SilverStripe\UserForms\Model\EditableFormField;
|
|||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\Forms\LabelField;
|
use SilverStripe\Forms\LabelField;
|
||||||
use SilverStripe\UserForms\FormField\UserFormsGroupField;
|
use SilverStripe\UserForms\FormField\UserFormsGroupField;
|
||||||
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -194,7 +194,7 @@ class EditableMultipleOptionField extends EditableFormField
|
|||||||
*
|
*
|
||||||
* @return DataObject
|
* @return DataObject
|
||||||
*/
|
*/
|
||||||
public function duplicate($doWrite = true)
|
public function duplicate($doWrite = true, $manyMany = 'many_many')
|
||||||
{
|
{
|
||||||
$clonedNode = parent::duplicate();
|
$clonedNode = parent::duplicate();
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class EditableOption extends DataObject
|
|||||||
* @param array $context Virtual parameter to allow context to be passed in to check
|
* @param array $context Virtual parameter to allow context to be passed in to check
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function canCreate($member = null)
|
public function canCreate($member = null, $context = [])
|
||||||
{
|
{
|
||||||
// Check parent page
|
// Check parent page
|
||||||
$parent = $this->getCanCreateContext(func_get_args());
|
$parent = $this->getCanCreateContext(func_get_args());
|
||||||
|
@ -26,7 +26,7 @@ use SilverStripe\Forms\TextField;
|
|||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableEmailField;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableEmailField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableMultipleOptionField;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableMultipleOptionField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableTextField;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableTextField;
|
||||||
use SilverStripe\UserForms\Model\Recipient\EmailRecipientCondition;
|
use SilverStripe\UserForms\Model\Recipient\EmailRecipientCondition;
|
||||||
@ -376,7 +376,7 @@ class EmailRecipient extends DataObject
|
|||||||
* @param array $context Virtual parameter to allow context to be passed in to check
|
* @param array $context Virtual parameter to allow context to be passed in to check
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function canCreate($member = null)
|
public function canCreate($member = null, $context = [])
|
||||||
{
|
{
|
||||||
// Check parent page
|
// Check parent page
|
||||||
$parent = $this->getCanCreateContext(func_get_args());
|
$parent = $this->getCanCreateContext(func_get_args());
|
||||||
|
@ -7,7 +7,7 @@ use SilverStripe\CMS\Controllers\CMSMain;
|
|||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\UserForms\Model\Recipient\EmailRecipient;
|
use SilverStripe\UserForms\Model\Recipient\EmailRecipient;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declares a condition that determines whether an email can be sent to a given recipient
|
* Declares a condition that determines whether an email can be sent to a given recipient
|
||||||
@ -109,7 +109,7 @@ class EmailRecipientCondition extends DataObject
|
|||||||
* @param array $context Virtual parameter to allow context to be passed in to check
|
* @param array $context Virtual parameter to allow context to be passed in to check
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function canCreate($member = null)
|
public function canCreate($member = null, $context = [])
|
||||||
{
|
{
|
||||||
// Check parent page
|
// Check parent page
|
||||||
$parent = $this->getCanCreateContext(func_get_args());
|
$parent = $this->getCanCreateContext(func_get_args());
|
||||||
|
@ -26,10 +26,13 @@ class UserFormRecipientEmail extends Email
|
|||||||
* Set the "Reply-To" header with an email address rather than append as
|
* Set the "Reply-To" header with an email address rather than append as
|
||||||
* {@link Email::replyTo} does.
|
* {@link Email::replyTo} does.
|
||||||
*
|
*
|
||||||
* @param string $email The email address to set the "Reply-To" header to
|
* @param string|array $address
|
||||||
|
* @param string|null $name
|
||||||
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setReplyTo($email)
|
public function setReplyTo($address, $name = null)
|
||||||
{
|
{
|
||||||
$this->customHeaders['Reply-To'] = $email;
|
$this->customHeaders['Reply-To'] = $email;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ class SubmittedForm extends DataObject
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function canCreate($member = null)
|
public function canCreate($member = null, $context = [])
|
||||||
{
|
{
|
||||||
$extended = $this->extendedCan(__FUNCTION__, $member);
|
$extended = $this->extendedCan(__FUNCTION__, $member);
|
||||||
if ($extended !== null) {
|
if ($extended !== null) {
|
||||||
|
@ -34,7 +34,7 @@ class SubmittedFormField extends DataObject
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function canCreate($member = null)
|
public function canCreate($member = null, $context = [])
|
||||||
{
|
{
|
||||||
return $this->Parent()->canCreate();
|
return $this->Parent()->canCreate();
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ namespace SilverStripe\UserForms\Model;
|
|||||||
use Page;
|
use Page;
|
||||||
use Colymba\BulkManager\BulkManager;
|
use Colymba\BulkManager\BulkManager;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
|
|
||||||
use SilverStripe\Forms\CheckboxField;
|
use SilverStripe\Forms\CheckboxField;
|
||||||
use SilverStripe\Forms\CompositeField;
|
use SilverStripe\Forms\CompositeField;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
@ -33,7 +32,6 @@ use SilverStripe\ORM\DB;
|
|||||||
use SilverStripe\UserForms\Extension\UserFormFieldEditorExtension;
|
use SilverStripe\UserForms\Extension\UserFormFieldEditorExtension;
|
||||||
use SilverStripe\UserForms\Extension\UserFormValidator;
|
use SilverStripe\UserForms\Extension\UserFormValidator;
|
||||||
use SilverStripe\UserForms\Form\UserFormsGridFieldFilterHeader;
|
use SilverStripe\UserForms\Form\UserFormsGridFieldFilterHeader;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
|
||||||
use SilverStripe\UserForms\Model\Recipient\EmailRecipient;
|
use SilverStripe\UserForms\Model\Recipient\EmailRecipient;
|
||||||
use SilverStripe\UserForms\Model\Recipient\UserFormRecipientItemRequest;
|
use SilverStripe\UserForms\Model\Recipient\UserFormRecipientItemRequest;
|
||||||
use SilverStripe\UserForms\Model\Submission\SubmittedForm;
|
use SilverStripe\UserForms\Model\Submission\SubmittedForm;
|
||||||
|
@ -5,7 +5,7 @@ namespace SilverStripe\UserForms\Task;
|
|||||||
use SilverStripe\Dev\MigrationTask;
|
use SilverStripe\Dev\MigrationTask;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UserForms Column Clean Task
|
* UserForms Column Clean Task
|
||||||
|
@ -10,7 +10,7 @@ use SilverStripe\Security\Member;
|
|||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableCheckbox;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableCheckbox;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableDropdown;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableDropdown;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFileField;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFileField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableOption;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableOption;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableRadioField;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableRadioField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableTextField;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableTextField;
|
||||||
|
@ -16,7 +16,7 @@ use SilverStripe\UserForms\Extension\UserFormValidator;
|
|||||||
use SilverStripe\UserForms\Model\EditableCustomRule;
|
use SilverStripe\UserForms\Model\EditableCustomRule;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableEmailField;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableEmailField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableDropdown;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableDropdown;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFormField;
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroupEnd;
|
||||||
use SilverStripe\UserForms\Model\Recipient\EmailRecipient;
|
use SilverStripe\UserForms\Model\Recipient\EmailRecipient;
|
||||||
@ -50,7 +50,7 @@ class UserDefinedFormTest extends FunctionalTest
|
|||||||
$form->doPublish();
|
$form->doPublish();
|
||||||
|
|
||||||
// check published site
|
// check published site
|
||||||
$updated = Versioned::get_one_by_stage(UserDefinedForm::class, 'Stage', \"UserDefinedForm\".\"ID\" = $form->ID");
|
$updated = Versioned::get_one_by_stage(UserDefinedForm::class, 'Stage', "\"UserDefinedForm\".\"ID\" = $form->ID");
|
||||||
$this->assertEquals($updated->SubmitButtonText, 'Updated Button Text');
|
$this->assertEquals($updated->SubmitButtonText, 'Updated Button Text');
|
||||||
|
|
||||||
$form->doRollbackTo($origVersion);
|
$form->doRollbackTo($origVersion);
|
||||||
|
Loading…
Reference in New Issue
Block a user