You are here

public function DateRangeItem::onChange in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php \Drupal\datetime_range\Plugin\Field\FieldType\DateRangeItem::onChange()

Parameters

bool $notify: (optional) Whether to forward the notification to the parent. Defaults to TRUE. By passing FALSE, overrides of this method can re-use the logic of parent classes without triggering notification.

Overrides DateTimeItem::onChange

File

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

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