You are here

public function RouteSubscriber::configPermsParsePath in Custom Permissions 8

Custom permission paths to array of paths.

Parameters

string $path: Path(s) given by the user.

Return value

array|string Implode paths in array of strings.

1 call to RouteSubscriber::configPermsParsePath()
RouteSubscriber::alterRoutes in src/Routing/RouteSubscriber.php
Alters existing routes for a specific collection.

File

src/Routing/RouteSubscriber.php, line 48

Class

RouteSubscriber
Class RouteSubscriber.

Namespace

Drupal\config_perms\Routing

Code

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