Problem/Motivation
Creating a custom module that uses 'node_insert', 'form_alter' and other related hooks break Focal Point preview. Issue is either with Focal Point (issue opened there as well) or with Crop API.
Steps to reproduce
Enable Focal Point, Crop API, and create and enable a simple custom module using 'node_insert' or 'form_alter' hook, such as:
.module file:
function ucb_article_author_node_insert(EntityInterface $node) {
// Check if the inserted entity is of the 'Person Page' content type.
if ($node->getEntityTypeId() === 'node' && $node->bundle() === 'ucb_person') {
// Extract the first and last name from the entity's title.
$title = $node->getTitle();
// Create a taxonomy term using the extracted name.
$term = Term::create([
'vid' => 'byline',
'name' => $title,
'field_author_person_page' => [
'target_id' => $node->id(),
],
]);
// Save the taxonomy term to update the entity reference field.
$term->save();
}
}
Enable this module and then upload any image using focal point. The preview is broken sitewide (see screenshot)
Issue present on d9 and d10, various versions of both Focal Point and Crop API.
Proposed resolution
This is a major issue that needs to be fixed, prevents creating custom modules with specific hooks.
Remaining tasks
Fix bug
User interface changes
Unsure, bug fix
API changes
Bug fix
Data model changes
Bug fix