function _classified_presave in Classified Ads 7.3
Convert node to a database-compatible format.
Specifically, convert the date array to a timestamp. Nothing to return: changes are applied to the passed node.
Parameters
object $node: A Classified Ad node on the verge of being saved.
See also
File
- ./
classified.module, line 679 - A pure D7 classified ads module inspired by the ed_classified module.
Code
function _classified_presave($node) {
if (!isset($node->expires)) {
$node->expires = 0;
}
if (is_array($node->expires)) {
$node->expires = _classified_get_timestamp_from_date($node->expires);
}
elseif (is_int($node->expires) && $node->expires > 0) {
// Allows timestamps and pass them straight.
}
else {
// Set to non-expiring.
$node->expires = -1;
watchdog('classified', 'Invalid "expires" field on node @nid: @expires', array(
'@nid' => $node->nid,
'@expires' => var_export($node->expires, TRUE),
), WATCHDOG_WARNING, 'node/' . $node->nid);
}
}