You are here

class BasicUsageObserver in Changed Fields API 8.2

Same name and namespace in other branches
  1. 8.3 examples/changed_fields_basic_usage/src/BasicUsageObserver.php \Drupal\changed_fields_basic_usage\BasicUsageObserver
  2. 8 examples/changed_fields_basic_usage/src/BasicUsageObserver.php \Drupal\changed_fields_basic_usage\BasicUsageObserver

Class BasicUsageObserver.

Hierarchy

Expanded class hierarchy of BasicUsageObserver

1 file declares its use of BasicUsageObserver
changed_fields_basic_usage.module in examples/changed_fields_basic_usage/changed_fields_basic_usage.module
Contains changed_fields_basic_usage.module.

File

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

Namespace

Drupal\changed_fields_basic_usage
View source
class BasicUsageObserver implements ObserverInterface {

  /**
   * {@inheritdoc}
   */
  public function getInfo() {
    return [
      'article' => [
        'title',
        'body',
      ],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function update(SplSubject $nodeSubject) {
    $node = $nodeSubject
      ->getNode();
    $changedFields = $nodeSubject
      ->getChangedFields();

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

}

Members

Namesort descending Modifiers Type Description Overrides
BasicUsageObserver::getInfo public function Returns associative array of node types with their fields for watching. Overrides ObserverInterface::getInfo
BasicUsageObserver::update public function