Uploaded image for project: 'Moodle app'
  1. Moodle app
  2. MOBILE-3102

Make CoreMainMenuDelegate handlers optional without throwing an exception

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      This issue should only be tested in 1 device.

      1. Install the plugin attached to this issue in a site with MDL-66229 applied, in the local folder.
      2. In the app, login in that site and open any course. Check that you don't see "My awesome plugin" option in the top tabs.
      3. Now edit local/courseoptiontest/classes/output/mobile.php and remove the "javascript" return from the "init" function.
      4. Restart the app and open any course. Check that now you see the "My awesome plugin" in the top tabs.
      5. Edit local/courseoptiontest/classes/output/mobile.php and in the init function add a new field to the return: "disabled" => true.
      6. Restart the app and open any course. Check that now you don't see the "My awesome plugin" in the top tabs.
      Show
      This issue should only be tested in 1 device. Install the plugin attached to this issue in a site with  MDL-66229 applied, in the local folder. In the app, login in that site and open any course. Check that you don't see "My awesome plugin" option in the top tabs. Now edit local/courseoptiontest/classes/output/mobile.php and remove the "javascript" return from the "init" function. Restart the app and open any course. Check that now you see the "My awesome plugin" in the top tabs. Edit local/courseoptiontest/classes/output/mobile.php and in the init function add a new field to the return: "disabled" => true. Restart the app and open any course. Check that now you don't see the "My awesome plugin" in the top tabs.
    • Workaround:
      Hide

      Any handlers that may throw an exception in their init web service function must be defined in a plugin type other than a course format.

      Show
      Any handlers that may throw an exception in their init web service function must be defined in a plugin type other than a course format.
    • Affected Branches:
      MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Sprint:
      Moodle App 3.7.1

      Description

      Since MOBILE-2800, if handlers defined in a course format plugin do not initialise, courses using the format are not accessible in the app.

      If you have a CoreMainMenuDelegate handler defined and you want to make its display optional, you have to have its init function throw an exception.  If the handler is defined in a course format plugin, this exception will make the app think the plugin's handlers have not initialised, and the courses will be inaccessible.

      To get around this, we need a way to make these handlers optional without throwing an exception in the web service, like we do with the "restrict" array for other handler types.

       

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  30/Aug/19