The solution is very simple. In template.php file implement MY_THEME_preprocess_node()
. Example:
function MY_THEME_preprocess_node(&$variables) {
// dpm($variables);
if($variables['type'] == 'MY_CONTENT_TYPE') {
$date_field_value = $variables['content']['field_DATE_FIEL_NAME'][0]['value']; // find the correct value of your field
$converted_date = strtotime($date_field_value);
if(time() > $converted_date) {
hide($variables['content']['field_DATE_FIEL_NAME']);
}
}
}
you can also use hook_node_view
:
function MY_MODULE_node_view($node, $view_mode, $langcode) {
if($node->type == 'MY_CONTENT_TYPE') {
$date_field_value = $node->content['field_DATE_FIEL_NAME'][0]['value'];
$converted_date = strtotime($date_field_value);
if(time() > $converted_date) {
hide($node->content['field_DATE_FIEL_NAME']);
}
}
}