You are here

function acquia_lift_edit_mode_disable in Acquia Lift Connector 7

Disables edit mode and returns to the stored destination.

1 string reference to 'acquia_lift_edit_mode_disable'
acquia_lift_menu in ./acquia_lift.module
Implements hook_menu().

File

./acquia_lift.ui.inc, line 219
acquia_lift.ui.inc Provides functions needed for the front-end UI.

Code

function acquia_lift_edit_mode_disable() {
  unset($_SESSION['acquia_lift_edit_mode']);
  $goto = '';
  $options = array();
  if (isset($_SESSION['acquia_lift_personalize_edit_mode_return'])) {
    $goto = $_SESSION['acquia_lift_personalize_edit_mode_return'];
    if (strpos($goto, '#overlay=') === 0) {

      // If the original path was in the overlay, make sure we go back
      // to the overlay.
      $path = substr($goto, strlen('#overlay='));
      $goto = current_path();
      $options = array(
        'fragment' => 'overlay=' . $path,
      );
    }
    unset($_SESSION['acquia_lift_personalize_edit_mode_return']);

    // The above session variable trumps any destination that has been
    // set so we need to make sure drupal_goto() behaves correctly.
    if (isset($_GET['destination'])) {
      unset($_GET['destination']);
    }
  }
  elseif (isset($_GET['destination'])) {
    $goto = $_GET['destination'];
    unset($_GET['destination']);
  }
  if (acquia_lift_nav_message_is_set()) {
    acquia_lift_unset_nav_message();
  }
  drupal_goto($goto, $options);
}