Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-5367

Dataform field - default content.

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • 2.7.3, 2.8
    • 2.8
    • Set: Dataform
    • None
    • MOODLE_28_STABLE
    • MOODLE_27_STABLE, MOODLE_28_STABLE

    Description

      The purpose of issue is to normalize dataform field support for default content that can be populated to the field input element in the entry form.
      This includes also adjustment of the menu fields support and adding support to the text and text area fields.

      • DB support
        • Two additional database columns in the dataform_fields table:
          • defaultcontentmode: Whether default content is populated only in new entries or in any entry.
          • defaultcontent: The default content.
        • Upgrade.
      • Backup/restore support.
      • API
        • dataformfield::content_names() - Existing; needs to have public visibility.
        • dataformfield::content_is_empty() - Existing; needs to have public visibility.
        • dataformfieldform::definition_default_settings() - New; wrapper for the content definition settings.
        • dataformfieldform::get_data_default_content() - New; prepares the default content form data for DB; the return value will be assigned to the field's defaultcontent attribute in the get_data method.
        • dataformfieldform::validation_default_content() - New; validate the default content setting where applicable (e.g. the default content of the select field must be one of the field's options).
      • Lang strings.

      Adding field support requires at least the following:

      • Field form:
        • Implement dataformfield_<type>_form::definition_default_content().
        • (Optional) Implement dataformfield_<type>_form::data_preprocessing() if you need to convert the field defaultcontent data to the form definition elements data.
        • Implement dataformfield_<type>_form::get_data_default_content() to convert the form data to storable data which will be assigned to the defaultcontent attribute.
      • Field renderer:
        • Add content check in the dataformfield_<type>_renderer::display_edit() (or equivalent) method.
      • Field class:
        • (Optional) Implement dataformfield_<type>_<type>::get_defaultcontent() if you need to convert the stored content to workable content (e.g unserialize).
      • Tests:
        • Add \dataformfield\<type>\test\behat\defaultcontent class.

      Attachments

        Activity

          People

            itamart Itamar Tzadok
            itamart Itamar Tzadok
            Itamar Tzadok Itamar Tzadok
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Clockify

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