You are here

public function ConfigPermListForm::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 ConfigPermListForm::configPermsParsePath()
ConfigPermListForm::validateForm in src/Form/ConfigPermListForm.php
Form validation handler.

File

src/Form/ConfigPermListForm.php, line 228

Class

ConfigPermListForm
Class ConfigPermListForm.

Namespace

Drupal\config_perms\Form

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;
  }
}