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

1
2
3
4
5
6
7
8
9
10
11
12
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
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.