You are here

function _paragraphs_ajax_update_callback in Paragraphs 7

FAPI #ajax callback to update a paragraphs item.

1 string reference to '_paragraphs_ajax_update_callback'
paragraphs_field_widget_form_build in ./paragraphs.field_widget.inc
Widget form implementation for paragraphs.

File

./paragraphs.field_widget.inc, line 676
Holds functions for the paragraphs widgets.

Code

function _paragraphs_ajax_update_callback($form, $form_state) {

  // Get the information on what we're updating.
  $button = $form_state['triggering_element'];

  // Go three levels up in the form, to the whole widget.
  $element = drupal_array_get_nested_value($form, array_slice($button['#array_parents'], 0, -3));

  // Send back the rendered element and let Drupal wrap it in an AJAX command.
  return drupal_render($element);
}