You are here

class ExtendedFieldComparatorObserver in Changed Fields API 8.3

Same name and namespace in other branches
  1. 8 examples/changed_fields_extended_field_comparator/src/ExtendedFieldComparatorObserver.php \Drupal\changed_fields_extended_field_comparator\ExtendedFieldComparatorObserver
  2. 8.2 examples/changed_fields_extended_field_comparator/src/ExtendedFieldComparatorObserver.php \Drupal\changed_fields_extended_field_comparator\ExtendedFieldComparatorObserver

Implementation of an example observer.

Hierarchy

Expanded class hierarchy of ExtendedFieldComparatorObserver

1 file declares its use of ExtendedFieldComparatorObserver
changed_fields_extended_field_comparator.module in examples/changed_fields_extended_field_comparator/changed_fields_extended_field_comparator.module
This is the Changed Fields Extended Field Comparator example module.

File

examples/changed_fields_extended_field_comparator/src/ExtendedFieldComparatorObserver.php, line 10

Namespace

Drupal\changed_fields_extended_field_comparator
View source
class ExtendedFieldComparatorObserver 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