If template_process_HOOK
is part of your form, you should have access to your entity in $variables['form']['#entity']
.
/**
* Implements template_process_HOOK().
*/
function mymodule_preprocess_myhook(&$variables) {
$entity = $variables['form']['#entity'];
$field_name = $variables['form']['#field_name'];
$info = field_info_field($field_name);
$instance = field_info_instance($entity->entityType(), $field_name, $entity->type);
}
Alternatively use some ctools cache (ctools_object_cache_set()
/ctools_object_cache_get()
) or load the form from the cache via form_get_cache()
.