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

Core method to retrieve list of classes

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.7
    • Fix Version/s: BACKEND
    • Component/s: General
    • Labels:
    • Testing Instructions:
      1. Open report_eventlist
      2. Try filtering, clicking on elements, make sure everything works as expected
    • Affected Branches:
      MOODLE_27_STABLE

      Description

      I saw already two issues that need to retrieve list of classes in autoloaded locations, so I thought it would be very useful to have such methods in core.

      This issue introduces two new static functions:

      core_component::find_classes_in_plugins($plugintype, $subnamespace, $parentclass = null, $nonabstractonly = false);
      core_component::find_classes_in_components($componenttype, $subnamespace, $parentclass = null, $nonabstractonly = false);
      

      Where $plugintype has a mixed syntax and can be one of the following: 'mod'; 'mod_assign'; array('mod', 'block'); array('mod_assign','block_navigation); '*'
      $componenttype can be: 'core'; 'core_course'; array('core_course', 'core_availability'); '*'

      Using them core API can find plugins that implement it (as a faster and more structured alternative to callbacks). Since the list of classes in autoloaded locations is already cached, such call will be very fast even across multiple or all plugin and component types.
      Also as part of this issue the directory scanning in report_eventlist is replaced with those functions.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              marina Marina Glancy
              Peer reviewer:
              David Monllaó
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated: