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

\core\external\exporter does not normalise child values

    XMLWordPrintable

    Details

      Description

      If you have an other properties definition which contains child values (either within a type = array or multiple = true), the child values:

      1. are not normalised
        1. description is not applied
        2. null is not applied
      2. text formatters are not applied to the child elements

      For example, the following other properties definition will not achieve consistent results:

          public static function define_other_properties() : array {
              return [
                  'myrawstring' => ['type' => PARAM_RAW],
                  'myrawstringformat' => ['type' => PARAM_INT],
                  'foo' => [
                      'type' => [
                          'myrawstring' => ['type' => PARAM_RAW],
                          'myrawstringformat' => ['type' => PARAM_INT],
                      ],
                  ],
                  'bar' => [
                      'multiple' => true,
                      'type' => [
                          'myrawstring' => ['type' => PARAM_RAW],
                          'myrawstringformat' => ['type' => PARAM_INT],
                      ],
                  ],
                  'baz' => [
                      'type' => [
                          'bum' => [
                              'type' => [
                                  'myrawstring' => ['type' => PARAM_RAW],
                                  'myrawstringformat' => ['type' => PARAM_INT],
                              ],
                          ],
                      ],
                  ],
              ];
          }
      

      In the example, only the first myrawstring value would be automatically formatted. Similarly the WS fields for description and null would be missing entirely.

        Attachments

          Activity

            People

            • Assignee:
              dobedobedoh Andrew Nicols
              Reporter:
              dobedobedoh Andrew Nicols
              Participants:
              Component watchers:
              Jake Dallimore, Jun Pataleta, Ryan Wyllie, Adrian Greeve, Mihail Geshoski, Peter Dias, Juan Leyva, Jake Dallimore, Jun Pataleta, Ryan Wyllie
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: