You are here

public function Registry::getPrefixGroupedUserFunctions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Theme/Registry.php \Drupal\Core\Theme\Registry::getPrefixGroupedUserFunctions()

Gets all user functions grouped by the word before the first underscore.

Return value

array Functions grouped by the first prefix.

1 call to Registry::getPrefixGroupedUserFunctions()
Registry::postProcessExtension in core/lib/Drupal/Core/Theme/Registry.php
Completes the theme registry adding discovered functions and hooks.

File

core/lib/Drupal/Core/Theme/Registry.php, line 745
Contains \Drupal\Core\Theme\Registry.

Class

Registry
Defines the theme registry service.

Namespace

Drupal\Core\Theme

Code

public function getPrefixGroupedUserFunctions() {
  $functions = get_defined_functions();
  $grouped_functions = [];

  // Splitting user defined functions into groups by the first prefix.
  foreach ($functions['user'] as $function) {
    list($first_prefix, ) = explode('_', $function, 2);
    $grouped_functions[$first_prefix][] = $function;
  }
  return $grouped_functions;
}