Skip to content
Snippets Groups Projects

Hook order class method split

Closed nicxvan requested to merge issue/drupal-3484217:3484217-hookOrder into 11.x
1 unresolved thread

Closes #3484217

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
105 111 * TRUE for before/first, FALSE for after/last. Larger priority listeners
106 112 * fire first.
107 113 * @param array|null $others
108 * Other hook implementations to compare to, if any. The array is keyed by
109 * string containing a class and method separated by ::, the value is not
110 * used.
114 * Other hook implementations to compare to, if any. The array is an
115 * alternating list of class and method names.
111 116 *
112 117 * @return void
113 118 */
114 119 protected static function changePriority(ContainerBuilder $container, string $hook, string $class_and_method, bool $should_be_larger, ?array $others = NULL): void {
120 if (isset($others)) {
121 $mapped = [];
122 for ($i = 0; $i < count($others); $i += 2) {
123 $mapped[$others[$i] . '::' . $others[$i + 1]] = TRUE;
  • I think there should be some sort of check that $others[$i + 1] exists, or that $others has an even number of items. So if one part of a class/method expected pair is missing, maybe throw an Exception?

  • Please register or sign in to reply
  • closed

  • Please register or sign in to reply
    Loading