function entityform_submission_page in Entityform 7
Same name and namespace in other branches
- 7.2 entityform.module \entityform_submission_page()
Page for view submission
Parameters
object $entityform_type:
Return value
string Rendered view
2 string references to 'entityform_submission_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.
- entityform_menu in ./
entityform.module - Implements hook_menu().
File
- ./
entityform.module, line 908 - Module for the Entityform Entity - a starting point to create your own Entity and associated administration interface
Code
function entityform_submission_page($entityform_type, $show_display_id = NULL, $mode) {
$output = array();
if ($mode == 'admins') {
//showing reports view for admins
$submission_view = _entityform_get_type_data_setting($entityform_type, 'submissions_view');
}
else {
//showing current users submissions
$submission_view = _entityform_get_type_data_setting($entityform_type, 'user_submissions_view');
$output['return_link'] = array(
'#theme' => 'link',
'#path' => "eform/submit/{$entityform_type->type}",
'#text' => t('Return to form'),
'#options' => array(
'attributes' => array(),
'html' => FALSE,
),
);
}
// Previous setting used "view_name:display_id" - handle that condition.
$parts = explode(':', $submission_view);
$view_name = $parts[0];
$view = views_get_view($view_name);
$display_ids = array_keys($view->display);
// Remove master display.
array_shift($display_ids);
$links = '';
// Create links to other displays
foreach ($display_ids as $display_id) {
// Make sure this display is enabled
$enabled = !(isset($view->display[$display_id]->display_options['enabled']) && $view->display[$display_id]->display_options['enabled'] === FALSE);
// Don't provide direct links to export displays. These will be attached other displays.
if ($enabled && $view->display[$display_id]->display_plugin != 'views_data_export') {
$links[] = array(
'href' => _entityform_get_submissions_view_path($display_id),
'title' => $view->display[$display_id]->display_title,
);
}
if (empty($show_display_id)) {
// If $show_display_id was not provided us the first of the linked displays.
$show_display_id = $display_id;
}
}
if (count($links) > 1) {
$output['links'] = array(
'#theme' => 'links',
'#links' => $links,
'#attributes' => array(
'class' => 'tabs secondary',
),
);
}
$output['view'] = array(
'#type' => 'markup',
'#markup' => entityform_embed_view($view_name, $show_display_id, $entityform_type->type),
);
return $output;
}