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

Allowing blocks to implement a subplugin structure

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.9.6, 1.9.7, 2.0
    • Fix Version/s: None
    • Component/s: Blocks
    • Labels:
      None
    • Database:
      Any
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      Hi All,

      here comes a patch we found so usefull for designing complex extensible block components.

      Index: blocklib.php
      ===================================================================
      RCS file: /cvsroot/moodle/moodle/lib/blocklib.php,v
      retrieving revision 1.129.2.7
      diff -r1.129.2.7 blocklib.php
      1401a1402,1407
      >
      > // PATCH : Block subplugins detection and auto upgrade
      > if (method_exists($blockobj, 'update_subplugins'))

      { > $blockobj->update_subplugins($continueto); > }

      > // \PATCH

      Allowing moodle upgrade feature to explore a potential subplugin construction for a block.

      Example of block implementation :

      Adding the following function to a block scans subplugin structure and

      /**

      • Update subplugins.
      • @param string $return string The URL to prompt to the user to continue.
        */
        public function update_subplugins($return) {
        upgrade_plugins('vmoodle_lib', 'blocks/vmoodle/plugins/libs', $return);
        }

      Known remaining issues : this subplugin location is not compatible with the load_capability_def() (accesslib.php §3139) because of the

      $compparts = explode('/', $component);

      parsing.

      something as

      preg_match("/[^\/]+)\/?(.*)/", $component, $comparts) with final array shift would allow locating subplugins anywhere in the subtree of the block implementation.

      Cheers.

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            vf Valery Fremaux
            Tester:
            Nobody
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: