You are here

class RenameAdminPathsValidator in Rename Admin Paths 8.2

Hierarchy

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\Form
View 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

Namesort descending Modifiers Type Description Overrides
RenameAdminPathsValidator::isDefaultPath public static function Verify users not overwriting with the default path names, could lead to broken routes
RenameAdminPathsValidator::isValidPath public static function Force path replacement values to contain only lowercase letters, numbers, and underscores.