private function GoogleAdwordsPathTracker::_buildPathTree in Google AdWords Conversion Tracking 8
Build the GoogleAdwordsPathConfig path render tree
Return value
array $tree This is in the format of a render tree, with #configs=GoogleAdwordsPathConfig[]
1 call to GoogleAdwordsPathTracker::_buildPathTree()
- GoogleAdwordsPathTracker::buildPathTree in modules/
google_adwords_path/ src/ GoogleAdwordsPathTracker.php - Retrieve the path tree from cache, or ask for it to be rebuild
File
- modules/
google_adwords_path/ src/ GoogleAdwordsPathTracker.php, line 339 - Contains Drupal\google_adwords_path\GoogleAdwordsPathTracker.
Class
- GoogleAdwordsPathTracker
- Class GoogleAdwordsPathTracker.
Namespace
Drupal\google_adwords_pathCode
private function _buildPathTree() {
/**
* @var \Drupal\Core\Entity\EntityStorageInterface $path_storage
*/
$path_storage = $this->entity_type_manager
->getStorage('google_adwords_path_config');
/**
* @var GoogleAdwordsPathConfig[] $pathConfigs
*/
$pathConfigs = $path_storage
->loadByProperties(array(
'enabled' => TRUE,
));
$tree = [];
foreach ($pathConfigs as $pathConfig) {
/**
* @todo we have to deal with strings|arrays in the config entity
*
* @var string[] $paths
*/
$paths = $pathConfig
->get('paths');
if (is_string($paths)) {
// make sure it's an array
$paths = explode("\n", $paths);
}
foreach ($paths as $path) {
if (is_string($path)) {
$path = explode('/', trim($path));
}
static::_buildPathTreeRecursive($pathConfig, $tree, $path);
}
}
return $tree;
}