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

Exporters read structure for format fields produces invalid 'required'

XMLWordPrintable

    • 2
    • Team Hedgehog 2023 Sprint 4.3, Team Hedgehog 2023 Review 4

      The read structure of an exporter does not produce the expected `required` field for optional formatted fields. The optional property of the formatted property is not applied to the format.

      public static function define_properties() {
          return [
              'content' => [
                  'type' => PARAM_RAW,
                  'optional' => true,
              ],
              'contentformat' => [
                  'type' => PARAM_INT,
                  'optional' => true,
              ]
          ];
      }

      In the above example, the `contentformat` property will be marked as required. This is incorrect, it should be marked optional either from its own optional definition, or from its associated property.

      Attached is a patch that demonstrates the issue, and offers a fix by referring to the parent property.

            jpataleta Jun Pataleta
            fred Frédéric Massart
            Meirza Meirza
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 40 minutes
                3h 40m

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