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

Improvement to 'definition_after_data()' needed.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Inactive
    • Affects Version/s: 1.8.2, 1.9, 2.0
    • Fix Version/s: None
    • Component/s: Forms Library
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      The definition_after_data function in formslib is defined as:
      "This method is called after definition(), data submission and set_data(). All form setup that is dependent on form values should go in here."

      This makes it a very useful function to provide non-trivial form function. The trouble is, that it is being called many times (up to 3) from a form, with no indicator of what function is calling it (state).

      This function could be rendered much more useful if it passed a state value indicating which of the three possible callers is calling it. That way, code could act on the appropriate case.

      So, something like:
      definition_after_data ($state = 'unknown');
      where $state is 'definition', 'submission', 'set_data', etc.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            mchurch Mike Churchward
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: