class BasicUsageObserver in Changed Fields API 8.2
Same name and namespace in other branches
- 8.3 examples/changed_fields_basic_usage/src/BasicUsageObserver.php \Drupal\changed_fields_basic_usage\BasicUsageObserver
- 8 examples/changed_fields_basic_usage/src/BasicUsageObserver.php \Drupal\changed_fields_basic_usage\BasicUsageObserver
Class BasicUsageObserver.
Hierarchy
- class \Drupal\changed_fields_basic_usage\BasicUsageObserver implements ObserverInterface
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_usageView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BasicUsageObserver:: |
public | function |
Returns associative array of node types with their fields for watching. Overrides ObserverInterface:: |
|
BasicUsageObserver:: |
public | function |