You are here

function entityform_empty_load in Entityform 7.2

Same name and namespace in other branches
  1. 7 entityform.module \entityform_empty_load()
2 calls to entityform_empty_load()
EntityformTypeController::view in ./entityform.module
Implements EntityAPIControllerInterface.
entityform_form_wrapper_preview in ./entityform.admin.inc
Form callback wrapper: preview an entityform.

File

./entityform.module, line 602
Module for the Entityform Entity - a starting point to create your own Entity and associated administration interface

Code

function entityform_empty_load($type) {
  $submit_404 =& drupal_static(__FUNCTION__);
  $type = str_replace("-", "_", $type);
  $empty_entityform = entityform_create(array(
    'type' => $type,
  ));
  if (empty($empty_entityform)) {

    // Entityform didn't load correctly. Probably because of mistyped url
    if (strpos(current_path(), 'eform/submit/') === 0) {

      /* Have to keep track of whether we have already been here because
       * drupal_not_found() will load menu item again(infinite loop!!).
       */
      if ($submit_404) {
        return NULL;
      }
      $submit_404 = TRUE;
      drupal_not_found();
    }
  }
  return $empty_entityform;
}