You are here

function config_perms_parse_path in Custom Permissions 8.2

Same name and namespace in other branches
  1. 6.2 config_perms.module \config_perms_parse_path()
  2. 7.2 config_perms.module \config_perms_parse_path()

Custom permission paths to array of paths.

Parameters

string|array $route: Path(s) given by the user.

Return value

array|string Implode paths in array of strings.

4 calls to config_perms_parse_path()
ConfigPermListForm::validateForm in src/Form/ConfigPermListForm.php
Form validation handler.
ConfigPermsAccessCheck::access in src/Access/ConfigPermsAccessCheck.php
A custom access check.
config_perms_update_8201 in ./config_perms.install
Updates the paths to its entities.
RouteSubscriber::alterRoutes in src/Routing/RouteSubscriber.php
Alters existing routes for a specific collection.

File

./config_perms.module, line 35
The Custom permissions .module file.

Code

function config_perms_parse_path($route) {
  if (is_array($route)) {
    $string = implode("\n", $route);
    return $string;
  }
  else {
    $route = str_replace([
      "\r\n",
      "\n\r",
      "\n",
      "\r",
    ], "\n", $route);
    $parts = explode("\n", $route);
    return $parts;
  }
}