You are here

protected function PathTrait::joinPaths in Tome 8

Joins multiple paths.

Original credit to Riccardo Galli.

Return value

string The joined path.

See also

https://stackoverflow.com/a/15575293

8 calls to PathTrait::joinPaths()
FileSync::deleteFile in modules/tome_sync/src/FileSync.php
Deletes an exported file by name.
FileSync::deleteFileExport in modules/tome_sync/src/FileSync.php
Deletes an exported file by entity.
FileSync::exportFile in modules/tome_sync/src/FileSync.php
Exports a file to the export directory.
LanguagePathSubscriber::collectPaths in modules/tome_static/src/EventSubscriber/LanguagePathSubscriber.php
Reacts to a collect paths event to add multilingual homepage paths.
StaticGenerator::getDestination in modules/tome_static/src/StaticGenerator.php
Returns a destination for saving a given path.

... See full list

File

modules/tome_base/src/PathTrait.php, line 22

Class

PathTrait
Contains methods useful for working with paths.

Namespace

Drupal\tome_base

Code

protected function joinPaths() {
  $paths = [];
  foreach (func_get_args() as $arg) {
    if ($arg !== '') {
      $paths[] = $arg;
    }
  }
  return rtrim(preg_replace('#(?<!:)/+#', '/', implode('/', $paths)), '/');
}