function TextItemBase::onChange

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

Overrides Map::onChange

File

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

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

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