You are here

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

Normalizes a path name to be the filename. Overrides HudtInternal method.

Parameters

string $quasi_name: A path to normalize and create a filename from.

Return value

string A string resembling a filename with hyphens and -export.txt.

2 calls to Nodes::normalizeFileName()
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 132

Class

Nodes
Public method for changing nodes programatically.

Namespace

HookUpdateDeployTools

Code

public static function normalizeFileName($quasi_name) {

  // Remove non-drupal like leading slash.
  $quasi_name = trim($quasi_name, '/');
  $items = array(
    // Remove in case it is already present.
    '.txt' => '',
    // Convert path directories to filename friendly replacement slug.
    '/' => 'zZz',
  );
  $file_name = str_replace(array_keys($items), array_values($items), $quasi_name);
  $file_name = "{$file_name}.txt";
  return $file_name;
}