You are here

function _custom_pagers_visibility in Custom Pagers 7

Same name and namespace in other branches
  1. 5 custom_pagers.module \_custom_pagers_visibility()
  2. 6 custom_pagers.module \_custom_pagers_visibility()
2 calls to _custom_pagers_visibility()
custom_pagers_block_view in ./custom_pagers.module
Implements hook_block_view().
custom_pagers_node_view in ./custom_pagers.module
Implements hook_node_view().

File

./custom_pagers.module, line 216
Allows administrators to define context-sensitive previous/next pagers for any node type.

Code

function _custom_pagers_visibility($pager, $node) {
  $visible = FALSE;
  if (!empty($pager->visibility_php)) {

    // Use PHP code to generate the list.
    ob_start();
    $result = eval(trim($pager->visibility_php));
    $visible = $result == TRUE;
    ob_end_clean();
  }
  elseif (!empty($pager->node_type)) {
    $visible = strpos($pager->node_type, $node->type) !== FALSE;
  }
  return $visible;
}