You are here

private static function AddUpdateForm::checkPathLeadingSlash in Optimizely 8

Ensure that the path starts with a slash.

Parameters

string $path: Path to be checked for having a leading slash. If leading slash is missing, prefix one. If the path already starts with a special char such as * or < leave it alone.

Return value

string The path with a leading slash added, or the original path unchanged.

1 call to AddUpdateForm::checkPathLeadingSlash()
AddUpdateForm::checkPaths in src/AddUpdateForm.php
Ensure that for an array of paths, each path starts with a slash.

File

src/AddUpdateForm.php, line 344

Class

AddUpdateForm
Implements the form for the Add Projects page.

Namespace

Drupal\optimizely

Code

private static function checkPathLeadingSlash($path) {
  return ctype_alnum($path[0]) ? '/' . $path : $path;
}