You are here

private static function GoogleAdwordsPathTrackerBackup::_buildPathTreeRecursive in Google AdWords Conversion Tracking 8

Parameters

\Drupal\google_adwords_path\Entity\GoogleAdwordsPathConfig $pathConfig:

array $tree: a render tree of exploded path parts, into which the pathconfig item should be inserted

array $path: an exploded partial route|path to match the tree

1 call to GoogleAdwordsPathTrackerBackup::_buildPathTreeRecursive()
GoogleAdwordsPathTrackerBackup::_buildPathTree in modules/google_adwords_path/src/GoogleAdwordsPathTracker.backup.php
Build the GoogleAdwordsPathConfig path render tree

File

modules/google_adwords_path/src/GoogleAdwordsPathTracker.backup.php, line 256
Contains Drupal\google_adwords_path\GoogleAdwordsPathTracker.

Class

GoogleAdwordsPathTrackerBackup
Class GoogleAdwordsPathTracker.

Namespace

Drupal\google_adwords_path

Code

private static function _buildPathTreeRecursive(GoogleAdwordsPathConfig $pathConfig, array &$tree, array $path) {
  if (count($path) == 0) {
    if (!isset($tree[static::GOOGLE_ADWORDS_PATH_TREE_NODEKEY])) {
      $tree[static::GOOGLE_ADWORDS_PATH_TREE_NODEKEY] = [];
    }
    $tree[static::GOOGLE_ADWORDS_PATH_TREE_NODEKEY][] = $pathConfig;
  }
  else {

    /**
     * @var string $pathElement
     *   a single element of the path
     */
    $pathElement = array_pop($path);
    if (!isset($tree[$pathElement])) {
      $tree[$pathElement] = [];
    }
    self::_buildPathTreeRecursive($pathConfig, $tree[$pathElement], $path);
  }
}