function EditorHooks::entityInsert
Same name and namespace in other branches
- 11.x core/modules/editor/src/Hook/EditorHooks.php \Drupal\editor\Hook\EditorHooks::entityInsert()
Implements hook_entity_insert().
Attributes
#[Hook('entity_insert')]
File
-
core/
modules/ editor/ src/ Hook/ EditorHooks.php, line 195
Class
- EditorHooks
- Hook implementations for editor.
Namespace
Drupal\editor\HookCode
public function entityInsert(EntityInterface $entity) : void {
// Only act on content entities.
if (!$entity instanceof FieldableEntityInterface) {
return;
}
$referenced_files_by_field = $this->getFileUuidsByField($entity);
foreach ($referenced_files_by_field as $uuids) {
$this->recordFileUsage($uuids, $entity);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.