You are here

function path_breadcrumbs_ui_argument_context_form_ajax_callback in Path Breadcrumbs 7.2

Same name and namespace in other branches
  1. 7.3 path_breadcrumbs_ui/path_breadcrumbs_ui.module \path_breadcrumbs_ui_argument_context_form_ajax_callback()

Ajax callback for contexts selection form.

_state

Parameters

$form:

Return value

array|mixed

File

path_breadcrumbs_ui/path_breadcrumbs_ui.module, line 1091
Provide user interface for CRUD operations with path breadcrumbs.

Code

function path_breadcrumbs_ui_argument_context_form_ajax_callback($form, $form_state) {
  if (!form_get_errors()) {
    $values = $form_state['values'];
    $actions = $form_state['values']['actions'];
    $path_name = $form_state['storage']['path_name'];
    if (isset($actions['finish']) && $values['op'] == $actions['finish']) {

      // Add library for ctools modal dialog.
      ctools_include('modal');

      // Update second step of path breadcrumbs add form.
      $add_form_state = array(
        'storage' => array(
          'step' => 2,
          'machine_name' => $path_name,
        ),
      );
      $form = drupal_build_form('path_breadcrumbs_ui_add_form', $add_form_state);

      // Include additinal ajax commands.
      $commands[] = ajax_command_replace('#path-breadcrumbs-ui-argument-table', drupal_render($form['table']));
      $commands[] = ctools_modal_command_dismiss();
      return array(
        '#type' => 'ajax',
        '#commands' => $commands,
      );
    }
  }
  return $form;
}