Registry::getPrefixGroupedUserFunctions

public Registry::getPrefixGroupedUserFunctions()

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

Return value

array Functions grouped by the first prefix.

File

core/lib/Drupal/Core/Theme/Registry.php, line 750

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;
}
doc_Drupal
2016-10-29 09:37:15
Comments
Leave a Comment

Please login to continue.