function DateRangeItem::onChange

Same name in other branches
  1. 9 core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php \Drupal\datetime_range\Plugin\Field\FieldType\DateRangeItem::onChange()
  2. 8.9.x core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php \Drupal\datetime_range\Plugin\Field\FieldType\DateRangeItem::onChange()
  3. 10 core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php \Drupal\datetime_range\Plugin\Field\FieldType\DateRangeItem::onChange()

Overrides DateTimeItem::onChange

File

core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php, line 128

Class

DateRangeItem
Plugin implementation of the 'daterange' field type.

Namespace

Drupal\datetime_range\Plugin\Field\FieldType

Code

public function onChange($property_name, $notify = TRUE) {
    // Enforce that the computed date is recalculated.
    if ($property_name == 'value') {
        $this->start_date = NULL;
    }
    elseif ($property_name == 'end_value') {
        $this->end_date = NULL;
    }
    parent::onChange($property_name, $notify);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.