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

Availability plugins cannot have a settings page

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.6.7, 2.6.8, 2.6.9, 2.6.10, 2.6.11, 2.7.4, 2.7.5, 2.7.6, 2.7.7, 2.7.8, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.9
    • Fix Version/s: None
    • Component/s: Conditional activities
    • Labels:
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE

      Description

      The settings.php file inside an availability plugin is ignored.
      The reason is the method load_settings is not overrided for the availability class (in lib/classes/plugininfo/availability.php)

      adding the following chunk to the availability class definition could resolve the issue:

      public function load_settings(\part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) {
          global $CFG, $USER, $DB, $OUTPUT, $PAGE; // In case settings.php wants to refer to them.
          $ADMIN = $adminroot; // May be used in settings.php.
          $plugininfo = $this; // Also can be used inside settings.php.
       
          if (!$this->is_installed_and_upgraded()) {
              return;
          }
       
          if (file_exists($this->full_path('settings.php'))) {
              include($this->full_path('settings.php'));
          }
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              rezaie9 Shamim Rezaie
              Participants:
              Component watchers:
              Sam Marshall, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: