You are here

function date_repeat_field_date_field_update_alter in Date 7.3

Same name and namespace in other branches
  1. 8 date_repeat_field/date_repeat_field.module \date_repeat_field_date_field_update_alter()
  2. 7.2 date_repeat_field/date_repeat_field.module \date_repeat_field_date_field_update_alter()

Implements hook_date_field_update_alter().

File

date_repeat_field/date_repeat_field.module, line 248
Creates the option of Repeating Date fields and manages Date Repeat fields.

Code

function date_repeat_field_date_field_update_alter(&$items, $context) {

  // If an RRULE with a frequency of NONE made it this far, unset it.
  if (!empty($items[0]['rrule']) && strpos($items[0]['rrule'], 'FREQ=NONE')) {
    $items[0]['rrule'] = NULL;
  }

  // If you have a repeating date field on a user and don't check the box to
  // repeat it, we end up with $items[0]['rrule'] = array('additions' => '',
  // 'exceptions' => '')); This will clean it up by getting rid of those bogus
  // values.
  // @todo Figure out where that's coming from. It doesn't happen on nodes.
  if (!empty($items[0]['rrule']) && is_array($items[0]['rrule'])) {
    $items[0]['rrule'] = NULL;
  }
}