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

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

XMLWordPrintable

      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).

            damyon Damyon Wiese
            damyon Damyon Wiese
            Ankit Agarwal Ankit Agarwal
            Dan Poltawski Dan Poltawski
            Marina Glancy Marina Glancy
            Votes:
            3 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

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