You are here

function amp_node_is_enabled in Accelerated Mobile Pages (AMP) 7

Get if the node is enabled.

Parameters

$node_id: Node id to check.

Return value

bool TRUE if enabled, FALSE otherwise.

2 calls to amp_node_is_enabled()
amp_is_amp_request in ./amp.module
Determines whether a request should return AMP HTML.
amp_node_view in ./amp.module
Implements hook_node_view().

File

./amp.module, line 1570

Code

function amp_node_is_enabled($node_id, $cache_override = FALSE) {

  // Setup a cache ID
  $cid = 'amp:node_enabled:' . $node_id;

  // If a cached entry exists, return it
  if (($cache = cache_get($cid, 'cache')) && $cache_override != TRUE) {
    $is_enabled = $cache->data;
  }
  else {
    $is_enabled = amp_db_is_node_enabled($node_id);

    // Cache the result.
    cache_set($cid, $is_enabled, 'cache');
  }
  return $is_enabled;
}