You are here

public static function RenameAdminPathsValidator::isValidPath in Rename Admin Paths 8.2

Force path replacement values to contain only lowercase letters, numbers, and underscores.

Parameters

string $value:

Return value

boolean

3 calls to RenameAdminPathsValidator::isValidPath()
RenameAdminPathsSettingsForm::validate in src/Form/RenameAdminPathsSettingsForm.php
Form element validation handler.
RenameAdminPathsValidatorTest::testInvalidPath in tests/src/Unit/Form/RenameAdminPathsValidatorTest.php
@dataProvider invalidPaths
RenameAdminPathsValidatorTest::testValidPath in tests/src/Unit/Form/RenameAdminPathsValidatorTest.php
@dataProvider validPaths

File

src/Form/RenameAdminPathsValidator.php, line 17

Class

RenameAdminPathsValidator

Namespace

Drupal\rename_admin_paths\Form

Code

public static function isValidPath(string $value) : bool {
  return (bool) preg_match('~^[a-zA-Z0-9_-]+$~', $value);
}