diff --git a/core/includes/form.inc b/core/includes/form.inc index 06ee164..638d922 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -131,10 +131,14 @@ $form_state['build_info']['base_form_id'] = $form_arg->getBaseFormID(); } return $form_arg->getFormID(); - } - - // Otherwise, the $form_arg is the form ID. - return $form_arg; + } else if (function_exists($form_arg)) { + // Otherwise, the $form_arg is the form ID. + return $form_arg; + } else { + // The form does not exist or the file with it's definition hasn't been + // loaded yet. + return FALSE; + } } /** @@ -174,7 +178,9 @@ $form_state['build_info']['args'] = $args; $form_id = _drupal_form_id($form_arg, $form_state); - return drupal_build_form($form_id, $form_state); + // If the definition of the form does not exist($form_id = FALSE), + // we return an empty array so nothing is rendered. + return $form_id ? drupal_build_form($form_id, $form_state) : array(); } /**