RenameAdminPathsValidator.php in Rename Admin Paths 8.2
File
src/Form/RenameAdminPathsValidator.php
View source
<?php
namespace Drupal\rename_admin_paths\Form;
use Drupal\rename_admin_paths\EventSubscriber\RenameAdminPathsEventSubscriber;
class RenameAdminPathsValidator {
public static function isValidPath(string $value) : bool {
return (bool) preg_match('~^[a-zA-Z0-9_-]+$~', $value);
}
public static function isDefaultPath(string $value) : bool {
return in_array(strtolower($value), RenameAdminPathsEventSubscriber::ADMIN_PATHS);
}
}