function modal_entityform_page_submit in Modal operations 7
Modal Entityform add page callback.
1 string reference to 'modal_entityform_page_submit'
- modal_entityform_menu in modal_entityform/
modal_entityform.module - Implements hook_menu().
File
- modal_entityform/
modal_entityform.module, line 71 - Allows entityform submitting and editing in modal window.
Code
function modal_entityform_page_submit($entityform, $js, $force_page_reload = TRUE) {
// Fall back if $js is not set.
if (!$js) {
$parameters = drupal_get_query_parameters();
unset($_GET['destination']);
drupal_goto('eform/submit/' . $entityform->type, array(
'query' => $parameters,
));
return NULL;
}
// Fix superglobals (such as $_GET) in order to make arg() work properly.
modal_set_path_data('eform/submit/' . $entityform->type);
ctools_include('modal');
ctools_include('ajax');
$entityform_type_entity = entityform_type_load($entityform->type);
if (!modal_entityform_access('submit', $entityform)) {
$commands = array(
ctools_modal_command_display(t('Access denied'), t('You are not authorized to access this page.')),
);
$commands[] = ajax_command_invoke('#modalContent', 'addClass', array(
'modal-denied-entityform modal-denied-entityform-' . $entityform->type,
));
drupal_alter('modal_entityform_submit_access_denied', $commands, $entityform_type_entity, $entityform);
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}
$title = $entityform_type_entity->label;
drupal_alter('modal_entityform_submit_title', $title, $entityform_type_entity, $entityform);
return modal_entityform_form($entityform, $title, $entityform_type_entity, $force_page_reload);
}