You are here

public function BasicUsageObserver::update in Changed Fields API 8

Same name and namespace in other branches
  1. 8.3 examples/changed_fields_basic_usage/src/BasicUsageObserver.php \Drupal\changed_fields_basic_usage\BasicUsageObserver::update()
  2. 8.2 examples/changed_fields_basic_usage/src/BasicUsageObserver.php \Drupal\changed_fields_basic_usage\BasicUsageObserver::update()

Update method with info about event.

It is called by NodeSubject when node fields have been changed.

Parameters

SubjectInterface $nodeSubject:

Overrides Observer::update

File

examples/changed_fields_basic_usage/src/BasicUsageObserver.php, line 21
Contains BasicUsageObserver.php.

Class

BasicUsageObserver
Class BasicUsageObserver.

Namespace

Drupal\changed_fields_basic_usage

Code

public function update(SubjectInterface $nodeSubject) {
  $node = $nodeSubject
    ->getNode();
  $changedFields = $nodeSubject
    ->getChangedFields();

  // Do something with $node depends on $changedFields.
}