You are here

function _modal_forms_active in Modal forms (with ctools) 7

Same name and namespace in other branches
  1. 6 modal_forms.module \_modal_forms_active()

Check if modal_forms should be active for the current URL.

Return value

bool TRUE if modal_forms should be active for the current page.

1 call to _modal_forms_active()
_modal_forms_doheader in ./modal_forms.module
Loads the various js and css files.

File

./modal_forms.module, line 173
Main file for the Modal Forms.

Code

function _modal_forms_active() {
  global $is_https;

  // Optionally disable modal activation for insecure/non-https pages.
  if (!$is_https && variable_get('modal_forms_ssl', 0)) {
    return FALSE;
  }

  // Code from the block_list funtion in block.module.
  $path = drupal_get_path_alias($_GET['q']);
  $modal_forms_pages = variable_get('modal_forms_pages', "admin*\nimagebrowser*\nimg_assist*\nimce*\nnode/add/*\nnode/*/edit\nprint/*\nprintpdf/*\nsystem/ajax\nsystem/ajax/*");

  // Compare with the internal and path alias (if any).
  $page_match = drupal_match_path($path, $modal_forms_pages);
  if ($path != $_GET['q']) {
    $page_match = $page_match || drupal_match_path($_GET['q'], $modal_forms_pages);
  }
  $page_match = variable_get('modal_forms_visibility', 0) == 0 ? !$page_match : $page_match;
  return $page_match;
}