BasicUsageObserver.php in Changed Fields API 8.2
Same filename and directory in other branches
Contains BasicUsageObserver.php.
Namespace
Drupal\changed_fields_basic_usageFile
examples/changed_fields_basic_usage/src/BasicUsageObserver.phpView source
<?php
/**
* @file
* Contains BasicUsageObserver.php.
*/
namespace Drupal\changed_fields_basic_usage;
use Drupal\changed_fields\ObserverInterface;
use SplSubject;
/**
* Class BasicUsageObserver.
*/
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.
}
}
Classes
Name | Description |
---|---|
BasicUsageObserver | Class BasicUsageObserver. |