SproutCMS

This is the code documentation for the SproutCMS project

function loadFromSession()

Load data and errors from the session, with optional record id validation

Expected session keys:
    record_id       Checked against $verify_record_id, session data is thrown away in case of mismatch
    field_values    Field data, loaded using Form::setData
    field_errors    Field errors, loaded using Form::setErrors

Usage

null|array Form::loadFromSession ( string $key [, mixed $verify_record_id ] );

Example

$data = Form::loadFromSession('register');
if (empty($data)) {
    $data = $this->add_defaults;
    Form::setData($data);
}

Arguments

  1. string $key
    Session key to get values from
  2. mixed $verify_record_id = NULL
    For edit record verification

Return value

  • array
    Loaded session data
  • null
    No session data found