You are here

public function SmartDateOverride::onChange in Smart Date 3.3.x

Same name and namespace in other branches
  1. 8.2 modules/smart_date_recur/src/Entity/SmartDateOverride.php \Drupal\smart_date_recur\Entity\SmartDateOverride::onChange()
  2. 3.x modules/smart_date_recur/src/Entity/SmartDateOverride.php \Drupal\smart_date_recur\Entity\SmartDateOverride::onChange()
  3. 3.0.x modules/smart_date_recur/src/Entity/SmartDateOverride.php \Drupal\smart_date_recur\Entity\SmartDateOverride::onChange()
  4. 3.1.x modules/smart_date_recur/src/Entity/SmartDateOverride.php \Drupal\smart_date_recur\Entity\SmartDateOverride::onChange()
  5. 3.2.x modules/smart_date_recur/src/Entity/SmartDateOverride.php \Drupal\smart_date_recur\Entity\SmartDateOverride::onChange()
  6. 3.4.x modules/smart_date_recur/src/Entity/SmartDateOverride.php \Drupal\smart_date_recur\Entity\SmartDateOverride::onChange()

Reacts to changes to a field.

Note that this is invoked after any changes have been applied.

Parameters

string $field_name: The name of the field which is changed.

Throws

\InvalidArgumentException When trying to assign a value to the language field that matches an existing translation.

\LogicException When trying to change:

  • The language of a translation.
  • The value of the flag identifying the default translation object.

Overrides ContentEntityBase::onChange

File

modules/smart_date_recur/src/Entity/SmartDateOverride.php, line 92

Class

SmartDateOverride
Defines the Smart Date override entity.

Namespace

Drupal\smart_date_recur\Entity

Code

public function onChange($property_name, $notify = TRUE) {

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