function exif_entity_create in Exif 8
Same name and namespace in other branches
- 8.2 exif.module \exif_entity_create()
Implements hook_entity_create().
File
- ./
exif.module, line 86 - Entry point for exif module.
Code
function exif_entity_create(EntityInterface $entity) {
$entityType = '';
if ($entity instanceof NodeInterface) {
$entityType = 'node';
}
else {
if (Drupal::moduleHandler()
->moduleExists("media_entity") && $entity instanceof MediaInterface) {
$entityType = 'media';
}
}
if ($entityType != '') {
$config = Drupal::configFactory()
->get('exif.settings');
$shouldUpdateMetadata = $config
->get('update_metadata');
if (!isset($shouldUpdateMetadata)) {
$shouldUpdateMetadata = TRUE;
}
$inserting = !isset($entity->original);
if ($inserting || $shouldUpdateMetadata) {
$exifContentHandler = new ExifContent();
$exifContentHandler
->checkTitle($entityType, $entity);
}
}
}