You are here

private static function NodeHookHandler::doNodePrepare in Node expire 7.2

Implements hook_node_prepare().

2 calls to NodeHookHandler::doNodePrepare()
NodeHookHandler::doNodeUpdateInsert in src/Module/Hook/NodeHookHandler.php
Implements hook_node_update() and hook_node_insert().
NodeHookHandler::hookNodePrepare in src/Module/Hook/NodeHookHandler.php
Implements hook_node_prepare().

File

src/Module/Hook/NodeHookHandler.php, line 144
NodeHookHandler class.

Class

NodeHookHandler
NodeHookHandler class.

Namespace

Drupal\node_expire\Module\Hook

Code

private static function doNodePrepare(&$ntype, $node) {

  // To prevent default value 1969-12-31 check also $ntypes['default'].
  if (!isset($node->expire) && $ntype['default']) {
    $node->expire = TimestampUtils::dateStrFromCfgDefault($ntype['default'], FALSE);
  }

  // This gives a way to users without edit exipration permission
  // to update nodes with default expiration.
  if (isset($node->expire) && !user_access('edit node expire')) {
    $node->expire = TimestampUtils::dateStrFromCfgDefault($ntype['default'], FALSE);
  }
}