You are here

function _bakery_save_destination_param in Bakery Single Sign-On System 8.2

Same name and namespace in other branches
  1. 6.2 bakery.module \_bakery_save_destination_param()
  2. 7.4 bakery.module \_bakery_save_destination_param()
  3. 7.2 bakery.module \_bakery_save_destination_param()
  4. 7.3 bakery.module \_bakery_save_destination_param()

Check if a form destination is set and save it in $data array.

Used to preserve destination in Bakery redirection to master and slave during login and registration.

Parameters

array $form: Form definition to check.

array $data: Array to store the detected destination value, if any.

2 calls to _bakery_save_destination_param()
_bakery_login_submit in ./bakery.module
Handle login by redirecting to master.
_bakery_register_submit in ./bakery.module
Handle registration by redirecting to master.

File

./bakery.module, line 309
For implementing different hooks for bakery SSO functionality.

Code

function _bakery_save_destination_param($form, &$data) {

  // Hold on to destination if set.
  if (strpos($form['#action'], 'destination=') !== FALSE) {

    // If an absolute URL is in destination parse_url() will issue a warning
    // and not populate $url_args so no further protection is needed.
    parse_str(parse_url($form['#action'], PHP_URL_QUERY), $url_args);
    if (!empty($url_args['destination'])) {
      $data['destination'] = $url_args['destination'];
    }
  }
}