Programmatically providing a default to hidden form items

In Chapter 6, Creating Forms with the Form API, we will have a recipe that details with altering forms. In order to provide a default value for an entity property hidden on the form display, you will need to alter the form and provide a default value. The Field API provides a way to set a default value when fields are created.