You are here

function entityform_empty_load in Entityform 7

Same name and namespace in other branches
  1. 7.2 entityform.module \entityform_empty_load()
1 call to entityform_empty_load()
EntityformTypeController::view in ./entityform.module
Implements EntityAPIControllerInterface.

File

./entityform.module, line 590
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;
}