hook_form_alter

Drupal 8 and hook form alter: How to check if taxonomy term is new or old?

Oct
2020
08
If you want to check with hook_form_alter if the taxonomy term is new or updated (old) you can't use the form_id or the $form_state->getFormObject()->getOperation() because it always returns "default". The solution for this is : $form_state->getFormObject()->getEntity()->isNew() So for example:
Subscribe to RSS - hook_form_alter
this is an arrow pointing back to the top of the page