You are here

function feedback_simple_preprocess_feedback_simple in Feedback Simple 7

Same name and namespace in other branches
  1. 6 feedback_simple.module \feedback_simple_preprocess_feedback_simple()

Implements hook_preprocess_feedback_simple().

File

./feedback_simple.module, line 70
Module file.

Code

function feedback_simple_preprocess_feedback_simple(&$variables) {

  // Hide the tab when on the $link page.
  if (current_path() == $variables['link']) {
    $variables['enabled'] = FALSE;
    return;
  }

  // Hide the tab if user doesn't have access.
  if (!user_access('view feedback simple')) {
    $variables['enabled'] = FALSE;
    return;
  }

  // Allow Drupal to apply base_path and locale prefix outside of the
  // theme registry cache.
  $variables['link'] = url($variables['link']);

  // Prevent breakage in subdirectory and multi-language sites.
  $variables['image'] = base_path() . $variables['image'];

  // Deny and allow rules.
  if (drupal_match_path(current_path(), $variables['deny'])) {
    $variables['enabled'] = FALSE;
  }
  if (drupal_match_path(current_path(), $variables['allow'])) {
    $variables['enabled'] = TRUE;
  }
}