← Back to team overview

mahara-contributors team mailing list archive

[Bug 1189823] Re: Pieforms attempts to load renderer plugin even when already loaded

 

Hi Luke,

Thanks for the patch! However, I don't think it's actually necessary. If
your intent is, say, to load the file
htdocs/pieforms/pieform/renderers/div.php so that you can call the
method "pieform_renderer_div()" from within another function, then you
can already do that. Pieform->include_plugin() uses "include_once()"
rather than "include()", so it won't error our if the file gets double-
included.

Or, if your intent is to tweak the behavior of one of the core renderers
by duplicating the method "pieform_renderer_div()" inside another file,
then the preferred way to achieve that would be to instead create an
entirely new pieform renderer, called, e.g. "fancydiv". You can store
this under your plugin's directories, and make pieform load it by adding
this to your form definitions:

'configdirs' => array(get_config('docroot') . 'path/to/my/plugin/');

On the third hand, if you've made some improvements to a core renderer
(like addressing the nested fieldsets issues), the recommended approach
is to submit those changes for upstreaming. We'll try not to take 3
years on it next time. ;)

Cheers,
Aaron

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1189823

Title:
  Pieforms attempts to load renderer plugin even when already loaded

Status in Mahara:
  Incomplete
Status in Mahara 16.04 series:
  Incomplete

Bug description:
  This prevents plugins from providing their own form renderers (useful
  for working around issues like #1181966 -- nested fieldsets are
  broken).

  I've attached a patch to the Pieforms library which changes the
  behaviour a little bit; if the renderer function already exists, we'll
  skip the loading process.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1189823/+subscriptions


References