You are here

function amp_db_is_node_enabled in Accelerated Mobile Pages (AMP) 7

Return TRUE if the node has amp enabled.

Parameters

$node_id: Node ID of the node to check

Return value

bool TRUE if AMP is enabled, FALSE otherwise.

2 calls to amp_db_is_node_enabled()
amp_form_node_form_alter in ./amp.module
Implements hook_form_BASE_FORM_ID_alter().
amp_node_is_enabled in ./amp.module
Get if the node is enabled.

File

includes/amp.db.inc, line 22
DB functions for AMP.

Code

function amp_db_is_node_enabled($node_id) {
  $is_enabled = TRUE;
  $result = db_select('amp_node', 'n')
    ->fields('n', array(
    'status',
  ))
    ->condition('aid', $node_id, '=')
    ->execute()
    ->fetchAll();

  // If we don't have an entry as disabled (!empty()), AMP is enabled by default
  if (isset($result[0]->status) && $result[0]->status == AMP_DISABLED) {
    $is_enabled = FALSE;
  }
  return $is_enabled;
}