widget

Drupal 8: Get widget state

When working with the hook altering the widget form, you often need to get the widget state to get the entities behind the form as well as additional information that is stored in the state. Here is the utility function for it.