mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 15:05:42 +00:00
API Remove deprecated code (#1185)
This commit is contained in:
parent
c11d22bbef
commit
1ea2b8e87f
@ -2,13 +2,11 @@
|
||||
|
||||
namespace SilverStripe\UserForms\Model;
|
||||
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\CMS\Controllers\CMSMain;
|
||||
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Core\ClassInfo;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
||||
use SilverStripe\Forms\CheckboxField;
|
||||
use SilverStripe\Forms\DropdownField;
|
||||
@ -24,13 +22,11 @@ use SilverStripe\Forms\ReadonlyField;
|
||||
use SilverStripe\Forms\SegmentField;
|
||||
use SilverStripe\Forms\TabSet;
|
||||
use SilverStripe\Forms\TextField;
|
||||
use SilverStripe\ORM\ArrayList;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\ORM\FieldType\DBField;
|
||||
use SilverStripe\ORM\FieldType\DBVarchar;
|
||||
use SilverStripe\ORM\HasManyList;
|
||||
use SilverStripe\ORM\SS_List;
|
||||
use SilverStripe\ORM\ValidationException;
|
||||
use SilverStripe\UserForms\Extension\UserFormFieldEditorExtension;
|
||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
|
||||
@ -648,19 +644,6 @@ class EditableFormField extends DataObject
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Title for rendering in the front-end (with XML values escaped)
|
||||
*
|
||||
* @deprecated 4.12.0 Use $Title directly instead
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEscapedTitle()
|
||||
{
|
||||
Deprecation::notice('4.12.0', 'Use $Title directly instead');
|
||||
return Convert::raw2xml($this->Title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the numeric indicator (1.1.2) that represents it's nesting value
|
||||
*
|
||||
@ -943,21 +926,6 @@ class EditableFormField extends DataObject
|
||||
->setRecord($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine effective display rules for this field.
|
||||
*
|
||||
* @return SS_List
|
||||
* @deprecated 5.6.0 Will be removed without equivalent functionality to replace it
|
||||
*/
|
||||
public function EffectiveDisplayRules()
|
||||
{
|
||||
Deprecation::notice('5.6.0', 'Will be removed without equivalent functionality to replace it');
|
||||
if ($this->Required) {
|
||||
return ArrayList::create();
|
||||
}
|
||||
return $this->DisplayRules();
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts info from DisplayRules into array so UserDefinedForm->buildWatchJS can run through it.
|
||||
* @return array|null
|
||||
|
@ -115,12 +115,9 @@ class EditableMultipleOptionField extends EditableFormField
|
||||
/**
|
||||
* Duplicate a pages content. We need to make sure all the fields attached
|
||||
* to that page go with it
|
||||
*
|
||||
* @param bool $doWrite @deprecated
|
||||
* @param string $manyMany @deprecated
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function duplicate(bool $doWrite = true, ?array $manyMany = null): static
|
||||
public function duplicate(bool $doWrite = true, array|null $relations = null): static
|
||||
{
|
||||
$clonedNode = parent::duplicate(true);
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
namespace SilverStripe\UserForms\Model\EditableFormField;
|
||||
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
@ -70,16 +68,6 @@ class EditableOption extends DataObject
|
||||
self::$allow_empty_values = (bool) $allow;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 5.0.0 Use $Title in templates instead
|
||||
* @return string
|
||||
*/
|
||||
public function getEscapedTitle()
|
||||
{
|
||||
Deprecation::notice('5.0.0', 'Use $Title in templates instead');
|
||||
return Convert::raw2xml($this->Title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a value for $this->Value. If empty values are not allowed,
|
||||
* then this will return the title in the case of an empty value.
|
||||
|
@ -14,8 +14,6 @@ use SilverStripe\UserForms\Model\EditableFormField\EditableLiteralField;
|
||||
use SilverStripe\UserForms\Model\EditableFormField\EditableOption;
|
||||
use SilverStripe\UserForms\Model\EditableFormField\EditableRadioField;
|
||||
use SilverStripe\UserForms\Model\EditableFormField\EditableTextField;
|
||||
use SilverStripe\UserForms\Model\UserDefinedForm;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
|
||||
/**
|
||||
* @package userforms
|
||||
@ -61,38 +59,6 @@ class EditableFormFieldTest extends FunctionalTest
|
||||
$this->assertFalse($text->canDelete());
|
||||
}
|
||||
|
||||
public function testCustomRules()
|
||||
{
|
||||
if (Deprecation::isEnabled()) {
|
||||
$this->markTestSkipped('Test calls deprecated code');
|
||||
}
|
||||
$this->logInWithPermission('ADMIN');
|
||||
$form = $this->objFromFixture(UserDefinedForm::class, 'custom-rules-form');
|
||||
|
||||
$checkbox = $form->Fields()->find('ClassName', EditableCheckbox::class);
|
||||
$field = $form->Fields()->find('ClassName', EditableTextField::class);
|
||||
|
||||
$rules = $checkbox->DisplayRules();
|
||||
|
||||
// form has 2 fields - a checkbox and a text field
|
||||
// it has 1 rule - when ticked the checkbox hides the text field
|
||||
$this->assertEquals(1, $rules->Count());
|
||||
|
||||
// EffectiveDisplayRules rule has been deprecated
|
||||
$this->assertEquals($rules, $checkbox->EffectiveDisplayRules());
|
||||
|
||||
$checkboxRule = $rules->First();
|
||||
$checkboxRule->ConditionFieldID = $field->ID;
|
||||
|
||||
$this->assertEquals($checkboxRule->Display, 'Hide');
|
||||
$this->assertEquals($checkboxRule->ConditionOption, 'HasValue');
|
||||
$this->assertEquals($checkboxRule->FieldValue, '6');
|
||||
|
||||
// If field is required then all custom rules are disabled
|
||||
$checkbox->Required = true;
|
||||
$this->assertEquals(0, $checkbox->EffectiveDisplayRules()->count());
|
||||
}
|
||||
|
||||
public function testEditableOptionEmptyValue()
|
||||
{
|
||||
$option = $this->objFromFixture(EditableOption::class, 'option-1');
|
||||
|
Loading…
x
Reference in New Issue
Block a user