class BasicUsageObserver in Changed Fields API 8.3
Same name and namespace in other branches
- 8 examples/changed_fields_basic_usage/src/BasicUsageObserver.php \Drupal\changed_fields_basic_usage\BasicUsageObserver
- 8.2 examples/changed_fields_basic_usage/src/BasicUsageObserver.php \Drupal\changed_fields_basic_usage\BasicUsageObserver
Implementation of an example observer.
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 - This is the Changed Fields Basic Usage example module.
File
- examples/
changed_fields_basic_usage/ src/ BasicUsageObserver.php, line 10
Namespace
Drupal\changed_fields_basic_usageView source
class BasicUsageObserver implements ObserverInterface {
/**
* {@inheritdoc}
*/
public function getInfo() {
return [
'node' => [
'article' => [
'title',
'body',
],
],
'user' => [
'user' => [
'name',
'mail',
],
],
'taxonomy_term' => [
'tags' => [
'name',
'description',
],
],
'comment' => [
'comment' => [
'subject',
'comment_body',
],
],
'shortcut' => [
'default' => [
'title',
'link',
],
],
'menu_link_content' => [
'menu_link_content' => [
'title',
'link',
],
],
'media' => [
'image' => [
'name',
'field_media_image',
],
],
'block_content' => [
'basic' => [
'info',
'body',
],
],
'aggregator_feed' => [
'aggregator_feed' => [
'title',
'refresh',
],
],
];
}
/**
* {@inheritdoc}
*/
public function update(\SplSubject $entity_subject) {
$entity = $entity_subject
->getEntity();
$changed_fields = $entity_subject
->getChangedFields();
// Do something with $entity depends on $changed_fields.
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BasicUsageObserver:: |
public | function |
Returns info for field comparator plugins. Overrides ObserverInterface:: |
|
BasicUsageObserver:: |
public | function |