You are here

public function TextItemBase::onChange in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php \Drupal\text\Plugin\Field\FieldType\TextItemBase::onChange()

Parameters

$property_name: The name of the property.

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 Map::onChange

File

core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php, line 58

Class

TextItemBase
Base class for 'text' configurable field types.

Namespace

Drupal\text\Plugin\Field\FieldType

Code

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

  // Unset processed properties that are affected by the change.
  foreach ($this->definition
    ->getPropertyDefinitions() as $property => $definition) {
    if ($definition
      ->getClass() == '\\Drupal\\text\\TextProcessed') {
      if ($property_name == 'format' || $definition
        ->getSetting('text source') == $property_name) {
        $this
          ->writePropertyValue($property, NULL);
      }
    }
  }
  parent::onChange($property_name, $notify);
}