You are here

function panels_everywhere_should_override in Panels Everywhere 7

Determine if Panels Everywhere should override the page.

1 call to panels_everywhere_should_override()
panels_everywhere_page_build in ./panels_everywhere.module
Impleme of hook_theme_registry_alter()

File

./panels_everywhere.module, line 201
panels_everywhere.module

Code

function panels_everywhere_should_override() {

  // Is our site template even enabled?
  if (!variable_get('panels_everywhere_site_template_enabled', FALSE)) {
    return FALSE;
  }

  // Protect the main editing template from possible destruction.
  if (strpos($_GET['q'], 'admin/structure/pages/nojs/operation/site_template') === 0) {
    return FALSE;
  }

  // The theme system might not yet be initialized. We need $theme.
  drupal_theme_initialize();
  global $theme;
  if (!variable_get('panels_everywhere_site_template_per_theme', FALSE)) {

    // If we've not selected to override 'per theme' check to see if we should
    // override based on the admin theme.
    if (!variable_get('panels_everywhere_site_template_enabled_admin', FALSE)) {
      $admin_theme = variable_get('admin_theme', '0');

      // Check that the admin theme is not the same as the default theme, which
      // is functionally equivalent with not having an admin theme set at all.
      $default_theme = variable_get('theme_default', 'bartik');
      if ($admin_theme && (!$default_theme || $default_theme != $admin_theme) && $admin_theme == $theme) {
        return FALSE;
      }
    }
    return TRUE;
  }
  return variable_get('panels_everywhere_override_theme_' . $theme, FALSE);
}