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

Core method to retrieve list of classes

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Won't Do
    • Minor
    • None
    • 2.7
    • General
    • MOODLE_27_STABLE
      1. Open report_eventlist
      2. Try filtering, clicking on elements, make sure everything works as expected

    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

              Unassigned Unassigned
              marina Marina Glancy
              David Monllaó David Monllaó
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: