You are here

function entityform_type_submit_page in Entityform 7.2

Page callback: Displays the entityform submission page

Handle the display of the entityform submission page. If the form is marked as closed then display the form intro text instead with a 'submissions are now closed' message. Users with 'administer entityform types' permission can still view the form as it would be inaccessible otherwise.

Parameters

$entityform_type: The entityform type to output.

Return value

A render array from entity_view or a string message.

1 string reference to 'entityform_type_submit_page'
EntityformUIController::hook_menu in ./entityform.admin.inc
Overrides hook_menu() defaults. Main reason for doing this is that parent class hook_menu() is optimized for entity type administration.

File

./entityform.admin.inc, line 208
Entityform editing UI.

Code

function entityform_type_submit_page($entityform_type) {
  $view = entity_view('entityform_type', array(
    $entityform_type,
  ), 'full', NULL, TRUE);

  // The form is not closed for new submissions.
  if (!isset($entityform_type->data['form_status']) || $entityform_type->data['form_status'] != ENTITYFORM_STATUS_CLOSED) {
    return $view;
  }
  else {

    // The form is closed but show it for administrators anyway with a warning
    // message.
    if (user_access('administer entityform types')) {
      drupal_set_message(t('This form is closed for new submissions and is only being shown because of your administrator role.'));
      return $view;
    }
    else {

      // When closed display the form intro text instead of the form or access
      // denied.
      drupal_set_message(t('Submissions for this form are now closed.'));
      return empty($entityform_type->data['instruction_pre']['value']) ? '' : $entityform_type->data['instruction_pre']['value'];
    }
  }
}