function EditorHooks::entityInsert

Implements hook_entity_insert().

Attributes

#[Hook('entity_insert')]

File

core/modules/editor/src/Hook/EditorHooks.php, line 191

Class

EditorHooks
Hook implementations for editor.

Namespace

Drupal\editor\Hook

Code

public function entityInsert(EntityInterface $entity) : void {
  // Only act on content entities.
  if (!$entity instanceof FieldableEntityInterface) {
    return;
  }
  $referenced_files_by_field = _editor_get_file_uuids_by_field($entity);
  foreach ($referenced_files_by_field as $uuids) {
    _editor_record_file_usage($uuids, $entity);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.