Issue #3376572 by Lendude, fnalb2, cilefen, longwave: SortPluginBase.php / validateExposeForm: spelling mistake in character class
parent
d55e9171e5
commit
edf79f6705
|
@ -230,7 +230,7 @@ abstract class SortPluginBase extends HandlerBase implements CacheableDependency
|
|||
'expose',
|
||||
'field_identifier',
|
||||
]);
|
||||
if (!preg_match('/^[a-zA-z][a-zA-Z0-9_~.\-]*$/', $field_identifier)) {
|
||||
if (!preg_match('/^[a-zA-Z][a-zA-Z0-9_~.\-]*$/', $field_identifier)) {
|
||||
$form_state->setErrorByName('expose][field_identifier', $this->t('This identifier has illegal characters.'));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -150,10 +150,13 @@ class ExposedFormUITest extends UITestBase {
|
|||
$this->submitForm($edit, 'Apply');
|
||||
$this->assertSession()->pageTextContains('Sort field identifier field is required.');
|
||||
|
||||
// Try with an invalid identifier.
|
||||
// Try with an invalid identifiers.
|
||||
$edit['options[expose][field_identifier]'] = 'abc&! ###08.';
|
||||
$this->submitForm($edit, 'Apply');
|
||||
$this->assertSession()->pageTextContains('This identifier has illegal characters.');
|
||||
$edit['options[expose][field_identifier]'] = '^abcde';
|
||||
$this->submitForm($edit, 'Apply');
|
||||
$this->assertSession()->pageTextContains('This identifier has illegal characters.');
|
||||
|
||||
// Use a valid identifier.
|
||||
$edit['options[expose][field_identifier]'] = $this->randomMachineName() . '_-~.';
|
||||
|
|
Loading…
Reference in New Issue