views_ui_add_ajax_wrapper($element, FormStateInterface $form_state)
After-build function that adds a wrapper to a form region (for AJAX refreshes).
This function inserts a wrapper around the region of the form that needs to be refreshed by AJAX, based on information stored in the corresponding submit button form element.
File
- core/modules/views_ui/admin.inc, line 158
- Provides the Views' administrative interface.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | function views_ui_add_ajax_wrapper( $element , FormStateInterface $form_state ) { // Find the region of the complete form that needs to be refreshed by AJAX. // This was earlier stored in a property on the element. $complete_form = & $form_state ->getCompleteForm(); $refresh_parents = $element [ '#views_ui_ajax_data' ][ 'refresh_parents' ]; $refresh_element = NestedArray::getValue( $complete_form , $refresh_parents ); // The HTML ID that AJAX expects was also stored in a property on the // element, so use that information to insert the wrapper <div> here. $id = $element [ '#views_ui_ajax_data' ][ 'wrapper' ]; $refresh_element += array ( '#prefix' => '' , '#suffix' => '' , ); $refresh_element [ '#prefix' ] = '<div id="' . $id . '" class="views-ui-ajax-wrapper">' . $refresh_element [ '#prefix' ]; $refresh_element [ '#suffix' ] .= '</div>' ; // Copy the element that needs to be refreshed back into the form, with our // modifications to it. NestedArray::setValue( $complete_form , $refresh_parents , $refresh_element ); return $element ; } |
Please login to continue.