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

Moodle url params cannot be arrays

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.6
    • Libraries
    • None
    • MOODLE_26_STABLE

      If you pass an array as one of the params to moodle_url params() function, the exception "Coding error detected, it must be fixed by a programmer: Url parameters values can not be arrays!" is thrown.

      This relates to MDL-29161. In the comments https://tracker.moodle.org/browse/MDL-29161?focusedCommentId=148346&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-148346 skodak asks where there is a usecase for moodle_url params() function to accept arrays.

      Here's what I'm trying to do.

      I have a form which controls the data being output in a report in a flexible table. The table should be pageable and downloadable. For those facilities to work, I need to set the base url for the table to include the form parameters.

      I'm trying $currentpage->params((array)$mform->get_data()))

      However, one of my form fields is a multi select box, which becomes an array of values, so the params call fails.

      In discussion with timhunt he has a similar requirement in quiz reports.

      The work around is to implode the array into a text string to pass as a single param, and then ensure all code handles the param as an array or a text string. But that's rather clunky.

      It would be great if moodle_url could handle this situation without workarounds.

            timhunt Tim Hunt
            jenny-gray Jenny Gray
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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