public function CurrentPathHelper::getPathElements in Menu Trail By Path 8
Returns a list of path elements based on the maximum path parts setting.
Return value
string[] A list of path elements.
Overrides PathHelperInterface::getPathElements
1 call to CurrentPathHelper::getPathElements()
File
- src/
Path/ CurrentPathHelper.php, line 71
Class
Namespace
Drupal\menu_trail_by_path\PathCode
public function getPathElements() {
$path = trim($this->context
->getPathInfo(), '/');
$path_elements = explode('/', $path);
// Limit the maximum number of path parts.
if (is_array($path_elements) && ($max_path_parts = $this->config
->get('max_path_parts'))) {
return array_splice($path_elements, 0, $max_path_parts);
}
return $path_elements;
}