You are here

function commerce_node_checkout_expire_get_node_expiration in Commerce Node Checkout 7

Get the expiration time for a given node.

Parameters

$node: A node object.

Return value

A timestamp of when the node expires, or expired. If the node does not have an expiration, NULL will be returned.

4 calls to commerce_node_checkout_expire_get_node_expiration()
CommerceNodeCheckoutExpireTests::getNodeExpiration in commerce_node_checkout_expire/commerce_node_checkout_expire.test
Get a node's expiration date, if one is set.
CommerceNodeCheckoutExpireTests::testCommerceNodeCheckoutExpire in commerce_node_checkout_expire/commerce_node_checkout_expire.test
Test everything we need to do with content, expiration, notifications, etc.
commerce_node_checkout_expire_relist_form in commerce_node_checkout_expire/commerce_node_checkout_expire.module
Provides form to enable a user to relist an expired/expiring node
commerce_node_checkout_expire_rules_set_line_item_expiration in commerce_node_checkout_expire/commerce_node_checkout_expire.rules.inc
Rules action callback to set the expiration date for a line item.

File

commerce_node_checkout_expire/commerce_node_checkout_expire.module, line 564
Provides core hooks and the like for the module.

Code

function commerce_node_checkout_expire_get_node_expiration($node) {

  // Load the last line item
  if ($line_item = commerce_node_checkout_expire_get_node_last_line_item($node)) {

    // Create a wrapper
    $wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);

    // Extract the expiration date
    return $wrapper->commerce_node_checkout_expires
      ->value();
  }
  return NULL;
}