You are here

function ga_push_method_available in GA Push 7

Same name and namespace in other branches
  1. 8 ga_push.module \ga_push_method_available()

Check if a GA PUSH method is available.

Parameters

string $method_key: Method identificator.

string $type: GA Push type.

Return value

bool Available.

2 calls to ga_push_method_available()
ga_push_add in ./ga_push.module
Add a new google analytics tracking push.
ga_push_get_methods_option_list in ./ga_push.module
Returns all available methods as option list.

File

./ga_push.module, line 530
Drupal Module: GA Push.

Code

function ga_push_method_available($method_key, $type = NULL) {
  $available = FALSE;
  $methods = ga_push_get_methods();
  $method = $methods[$method_key];

  // Checks the method:
  if (is_bool($method['available'])) {
    $available = $method['available'];
  }
  elseif (is_string($method['available'])) {
    $available = call_user_func($method['available']);
  }

  // Checks its implements:
  if (!is_null($type) && $available) {
    $available = isset($method['implements'][$type]) ? $method['implements'][$type] : FALSE;
  }
  return $available;
}