You are here

function microdata_ajax_bundle_mapping in Microdata 7

A modal callback for bundle mapping.

1 string reference to 'microdata_ajax_bundle_mapping'
microdata_menu in ./microdata.module
Implements hook_menu().

File

./microdata.admin.inc, line 110
Microdata administration and module settings UI.

Code

function microdata_ajax_bundle_mapping($entity_type, $bundle_name, $js = NULL) {

  // Fall back if $js is not set.
  if (!$js) {
    return drupal_get_form('microdata_bundle_mapping_form');
  }
  ctools_include('modal');
  ctools_include('ajax');
  $form_state = array(
    'title' => t('Login'),
    'ajax' => TRUE,
    '#entity_type' => $entity_type,
    '#bundle_type' => $bundle_name,
  );
  $output = ctools_modal_form_wrapper('microdata_bundle_mapping_form', $form_state);
  if (!empty($form_state['executed'])) {

    // We'll just overwrite the form output if it was successful.
    $output = array();
    $inplace = ctools_ajax_text_button(t('remain here'), 'ctools_ajax_sample/nojs/login/inplace', t('Go to your account'));
    $output[] = ctools_modal_command_display(t('Login Success'), '<div class="modal-message">Mapping saved. You can now choose whether to ' . $inplace . '.</div>');
  }
  print ajax_render($output);
  exit;
}