Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-81180

Support array callable notation for hook callback specification

    XMLWordPrintable

Details

    Description

      Currently hook callbacks must be written in the format:

          [
              'hook' => core\hook\after_config::class,
              'callback' => core\example::class . '::after_config',
              'priority' => 0,
          ],
      

      The callback line must be a string. This means that it is either specified as something like:

              'callback' => '\core\example::after_config',
      

      Or something like:

              'callback' => core\example::class . '::after_config',
      

      These both suck to write and for maintainability.

      I propose that we additionally support the standard array notation commonly used for callables, that is:

              'callback' => [core\example::class, 'after_config'],
      

      Attachments

        Issue Links

          Activity

            People

              dobedobedoh Andrew Lyons
              dobedobedoh Andrew Lyons
              Michael Hawkins Michael Hawkins
              Safat Shahin Safat Shahin
              CiBoT CiBoT
              Votes:
              1 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 2 hours, 33 minutes
                  1d 2h 33m

                  Clockify

                    Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.