You are here

function google_admanager_init in DFP Small Business (Google Ad Manager) 7.2

Same name and namespace in other branches
  1. 6.3 google_admanager.module \google_admanager_init()
  2. 6 google_admanager.module \google_admanager_init()
  3. 6.2 google_admanager.module \google_admanager_init()

Implements hook_init().

File

./google_admanager.module, line 47

Code

function google_admanager_init() {
  drupal_add_css(drupal_get_path('module', 'google_admanager') . '/google_admanager.css');
  if (variable_get('google_admanager_lazy', FALSE)) {
    drupal_add_js(drupal_get_path('module', 'google_admanager') . '/google_admanager.js');
  }

  // Add term attribute when on taxonomy view page
  if (arg(0) == "taxonomy" && arg(1) == "term" && is_numeric(arg(2))) {

    // If we have one or more enabled any vocabs as attributes, do we have an applicable term.
    $enabled_vocabs = variable_get('google_admanager_vocab_attributes', array());
    if (count($enabled_vocabs) >= 1) {
      $term = taxonomy_term_load(arg(2));
      if ($term && !empty($enabled_vocabs[$term->vid])) {
        google_admanager_add_term_attribute($term);
      }
    }
  }
}