class RenameAdminPathsValidator in Rename Admin Paths 8.2
Hierarchy
- class \Drupal\rename_admin_paths\Form\RenameAdminPathsValidator
Expanded class hierarchy of RenameAdminPathsValidator
1 file declares its use of RenameAdminPathsValidator
- RenameAdminPathsValidatorTest.php in tests/
src/ Unit/ Form/ RenameAdminPathsValidatorTest.php
File
- src/
Form/ RenameAdminPathsValidator.php, line 7
Namespace
Drupal\rename_admin_paths\FormView source
class RenameAdminPathsValidator {
/**
* Force path replacement values to contain only lowercase letters, numbers,
* and underscores.
*
* @param string $value
*
* @return boolean
*/
public static function isValidPath(string $value) : bool {
return (bool) preg_match('~^[a-zA-Z0-9_-]+$~', $value);
}
/**
* Verify users not overwriting with the default path names, could lead to
* broken routes
*
* @param string $value
*
* @return bool
*/
public static function isDefaultPath(string $value) : bool {
return in_array(strtolower($value), RenameAdminPathsEventSubscriber::ADMIN_PATHS);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RenameAdminPathsValidator:: |
public static | function | Verify users not overwriting with the default path names, could lead to broken routes | |
RenameAdminPathsValidator:: |
public static | function | Force path replacement values to contain only lowercase letters, numbers, and underscores. |