You are here

function photoswipe_active_nodetype in PhotoSwipe 6

Verify that PhotoSwipe should be active for the current node type.

1 call to photoswipe_active_nodetype()
photoswipe_init in ./photoswipe.module
Implementation of hook_init().

File

./photoswipe.module, line 87

Code

function photoswipe_active_nodetype() {
  $node = menu_get_object();
  $photoswipe_types = variable_get('photoswipe_nodetypes', array());
  if (count($photoswipe_types) > 0) {
    if (is_integer(max($photoswipe_types))) {

      // check whether any node type has been selected
      return TRUE;
    }
    else {
      return in_array($node->type, $photoswipe_types, $strict = TRUE);
    }

    // strict is needed to compare with the values and not the keys
  }
  else {
    return TRUE;
  }

  // return true if no type has been selected
}