W3cubDocs

/Drupal 8

public function 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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Theme!Registry.php/function/Registry::getPrefixGroupedUserFunctions/8.1.x