You are here

function date_repeat_field_date_field_update_alter in Date 8

Same name and namespace in other branches
  1. 7.3 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()

File

date_repeat_field/date_repeat_field.module, line 241
Creates the option of Repeating date fields and manages Date fields that use the Date Repeat API.

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;
  }
}