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

Deprecate inconsistent API to extend the navigation by local plugins

    XMLWordPrintable

Details

    • MOODLE_28_STABLE
    • MOODLE_29_STABLE
    • MDL-49643-master-local-nav
    • Hide

      You can use this very minimalistic plugin local_demo:

      <?php // version.php ///////////////////////////////////////////////////////////
       
      $plugin->version = 2015032300;
       
       
      <?php // lib.php ///////////////////////////////////////////////////////////////
       
      function local_demo_extends_navigation(global_navigation $navigation) {
          $navigation->add('Demo!');
      }
       
      function local_demo_extends_settings_navigation(settings_navigation $settings, $context) {
          if ($node = $settings->get('usercurrentsettings')) {
              $node->add('Awesome!');
          }
      }
       
       
      <?php // lang/en/local_demo.php ////////////////////////////////////////////////
       
      $string['pluginname'] = 'Demo local plugin';
      

      • Play with the file lib.php and make sure that both variants 'extends' and 'extend' actually work and the new texts appear in the blocks.
      • Make sure that the deprecated variant throws DEBUG_DEVELOPER message.
      • Make sure that if both current and deprecated variants exists, the current is used and no deprecation warning is displayed.
      Show
      You can use this very minimalistic plugin local_demo: <?php // version.php ///////////////////////////////////////////////////////////   $plugin->version = 2015032300;     <?php // lib.php ///////////////////////////////////////////////////////////////   function local_demo_extends_navigation(global_navigation $navigation) { $navigation->add('Demo!'); }   function local_demo_extends_settings_navigation(settings_navigation $settings, $context) { if ($node = $settings->get('usercurrentsettings')) { $node->add('Awesome!'); } }     <?php // lang/en/local_demo.php ////////////////////////////////////////////////   $string['pluginname'] = 'Demo local plugin'; Play with the file lib.php and make sure that both variants 'extends' and 'extend' actually work and the new texts appear in the blocks. Make sure that the deprecated variant throws DEBUG_DEVELOPER message. Make sure that if both current and deprecated variants exists, the current is used and no deprecation warning is displayed.

    Description

      Discussed at https://moodle.org/local/chatlogs/index.php?conversationid=17444

      It seems that MDL-22209 and MDL-30506 introduced inconsistent API for the local plugins to extend navigation. Whereas in all other places the callbacks are called in the imperative mood like <plugin>_extend_navigation() and <plugin>_extend_settings_navigation(), the local plugins have them like <plugin>_extends_navigation().

      Me and Eloy believe it was a mistake, probably confusion caused by the existence of the global_navigation::module_extends_navigation() method. As such, it should be fixed.

      Attachments

        Issue Links

          Activity

            People

              mudrd8mz David Mudrák (@mudrd8mz)
              mudrd8mz David Mudrák (@mudrd8mz)
              Tim Hunt Tim Hunt
              Dan Poltawski Dan Poltawski
              Rajesh Taneja Rajesh Taneja
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                11/May/15