You are here

function ffc_condition_execute_hide_date_time in Field formatter conditions 7

Hide date/time after from or to has expired.

File

./ffc.module, line 231
Field formatter conditions.

Code

function ffc_condition_execute_hide_date_time(&$build, $source, $configuration) {
  $field = $configuration['field'];
  if (!empty($build[$source]['#items'])) {
    foreach ($build[$source]['#items'] as $key => $info) {
      $time = $build[$source]['#field_type'] == 'datestamp' ? $info[$field] : strtotime($info[$field]);
      if ($time < REQUEST_TIME) {
        unset($build[$source]['#items'][$key]);
      }
    }
  }
  if (empty($build[$source]['#items'])) {
    $build[$source]['#access'] = FALSE;
  }
}