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

Allow renderers and renderables in a namespace to be auto loaded.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6, 2.7
    • Fix Version/s: 2.8
    • Component/s: Libraries

      Description

      For new plugins at least - it would be nice to be able to put the renderer in a class in the plugins classes folder and use a namespace instead of the full frankenstyle name for the class. Same goes for renderables - they currently can't be put in a namespace.

      Current situation:

      Currently we look for renderer class like this (depending on the renderer_factory):

      standard_renderer_factory

      (get_renderer called with $component = 'mod_assign', $subtype = 'custom', $target='ajax')

      Search list:

      mod_assign_custom_renderer_ajax
      mod_assign_custom_renderer
      

      theme_overridden_renderer_factory

      (get_renderer called with $component = 'mod_assign', $subtype = 'custom', $target='ajax' and theme_clean inherits from theme_bootstrapbase)

      Search list:

      theme_clean_mod_assign_custom_renderer_ajax
      theme_bootstrapbase_mod_assign_custom_renderer_ajax
      mod_assign_custom_renderer_ajax
      theme_clean_mod_assign_custom_renderer
      theme_bootstrapbase_mod_assign_custom_renderer
      mod_assign_custom_renderer
      

      renderables

      And currently renderables cannot existing in a namespace, because the class name is used in the render_xxx method of the renderer.

      After this patch:

      standard_renderer_factory

      (get_renderer called with $component = 'mod_assign', $subtype = 'custom', $target='ajax')

      Search list:

      \\mod_assign\\output\\custom_renderer_ajax
      \\mod_assign\\output\\custom_renderer
      mod_assign_custom_renderer_ajax
      mod_assign_custom_renderer
      

      theme_overridden_renderer_factory

      (get_renderer called with $component = 'mod_assign', $subtype = 'custom', $target='ajax' and theme_clean inherits from theme_bootstrapbase)

      Search list:

      theme_clean\\output\\mod_assign\\custom_renderer_ajax
      theme_clean_mod_assign_custom_renderer_ajax
      theme_bootstrapbase\\output\\mod_assign\\custom_renderer_ajax
      theme_bootstrapbase_mod_assign_custom_renderer_ajax
      \\mod_assign\\output\\custom_renderer_ajax
      mod_assign_custom_renderer_ajax
      theme_clean\\output\\mod_assign\\custom_renderer
      theme_clean_mod_assign_custom_renderer
      theme_bootstrapbase\\output\\mod_assign\\custom_renderer
      theme_bootstrapbase_mod_assign_custom_renderer
      \\mod_assign\\output\\custom_renderer
      mod_assign_custom_renderer
      

      renderables

      renderables can exist in the (e.g.) \mod_assign\output\test_renderable class, and the render method on the renderer will be "render_test" (_renderable is removed).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              damyon Damyon Wiese
              Reporter:
              damyon Damyon Wiese
              Peer reviewer:
              Ankit Agarwal
              Integrator:
              Dan Poltawski
              Tester:
              Marina Glancy
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              3 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Nov/14