function autosave_form_entity_type_alter in Autosave Form 8
Implements hook_entity_type_alter().
Sets the default autosave form handler to the entity type if it is not defined.
See also
\Drupal\Core\Entity\Annotation\EntityType
File
- ./
autosave_form.module, line 23 - This module holds autosave form functionality.
Code
function autosave_form_entity_type_alter(array &$entity_types) {
// Provide defaults for autosave info.
/** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
foreach ($entity_types as $entity_type) {
if (!$entity_type
->hasHandlerClass('autosave_form')) {
$entity_type
->setHandlerClass('autosave_form', AutosaveEntityFormHandler::class);
}
}
}