You are here

public static function Nodes::normalizePathName in Hook Update Deploy Tools 7

Normalizes a path to have slashes and removes file appendage.

Parameters

string $quasi_path: A path or a export file name to be normalized.

Return value

string A string resembling a machine name with underscores.

2 calls to Nodes::normalizePathName()
Nodes::export in src/Nodes.php
Exports a single Node based on its nid. (Typically called from Drush).
Nodes::import in src/Nodes.php
Performs the unique steps necessary to import node items from export files.

File

src/Nodes.php, line 155

Class

Nodes
Public method for changing nodes programatically.

Namespace

HookUpdateDeployTools

Code

public static function normalizePathName($quasi_path) {
  $items = array(
    // Remove file extension.
    '.txt' => '',
    // Convert slug back to directory slash.
    'zZz' => '/',
  );

  // @TODO Consider incorporating a limiter to make sure the path is not
  // longer than drupal supports. However this would be unable to export a
  // node from too long a path so it may be a non-issue.
  $path = str_replace(array_keys($items), array_values($items), $quasi_path);
  return $path;
}