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

Add a new return to tool_mobile_get_content to indicate handler is disabled

XMLWordPrintable

    • MOODLE_37_STABLE
    • MOODLE_38_STABLE
    • MDL-66229-master
    • Hide
      1. Install the plugin attached to this issue in a site (local/ folder) and enable Mobile services
      2. Run the app in docker:

        docker run -p 8100:8100 moodlehq/moodlemobile2:next
        

      3. Wait for the docker command to show:

        [05:42:29]  dev server running: http://localhost:8100/
        [05:42:52]  lint finished in 26.06 s
        

      4. Navigate to http://localhost:8100 in your browser
      5. In the app, login in to your test site and open any course
        1. Confirm that you don't see "My awesome plugin" option in the top tabs (see screenshot attached to this issue to view how it looks like when it is displayed).
      6. Open local/courseoptiontest/classes/output/mobile.php in your editor
      7. Find the init function and remove the "javascript" line
      8. Force refresh the browser screen you have with the app (Ctrl + F5)
      9. Navigate to the course again
        1. Confirm that you do now see the "My awesome plugin" option in the top tabs
      10. Add a new line to the return for the init function so that it looks like the following:

                return array(
                    'templates' => array(),
                    'disabled' => true,
                );
        

      11. Force refresh the browser screen you have with the app (Ctrl + F5)
      12. Navigate to the course again
        1. Confirm that the "My awesome plugin" option is no longer visible in the top tabs
      Show
      Install the plugin attached to this issue in a site (local/ folder) and enable Mobile services Run the app in docker: docker run -p 8100:8100 moodlehq/moodlemobile2:next Wait for the docker command to show: [05:42:29] dev server running: http://localhost:8100/ [05:42:52] lint finished in 26.06 s Navigate to http://localhost:8100 in your browser In the app, login in to your test site and open any course Confirm that you don't see "My awesome plugin" option in the top tabs (see screenshot attached to this issue to view how it looks like when it is displayed). Open local/courseoptiontest/classes/output/mobile.php in your editor Find the init function and remove the "javascript" line Force refresh the browser screen you have with the app (Ctrl + F5) Navigate to the course again Confirm that you do now see the "My awesome plugin" option in the top tabs Add a new line to the return for the init function so that it looks like the following: return array( 'templates' => array(), 'disabled' => true, ); Force refresh the browser screen you have with the app (Ctrl + F5) Navigate to the course again Confirm that the "My awesome plugin" option is no longer visible in the top tabs

      Right now, the only way to dynamically disable a plugin in the app is to throw a PHP exception in the init function. Using exceptions as normal code control flow isn't recommended and it's causing us some problems in the app since we can't determine if the plugin failed or it's disabled.

      We could add a new return param called "disabled". If we receive a true (or 1) in this field when calling the init function, the app will disabled that handler.

            jleyva Juan Leyva
            dpalou Dani Palou
            Dani Palou Dani Palou
            Andrew Lyons Andrew Lyons
            Jennifer Bauzon Jennifer Bauzon
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 30 minutes
                2h 30m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.