Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. WidgetBase.php

function WidgetBase::deleteAjax

Ajax refresh callback for the "Remove" button.

This returns the new widget element content to replace the previous content made obsolete by the form submission.

Parameters

array $form: The form array to remove elements from.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

File

core/lib/Drupal/Core/Field/WidgetBase.php, line 442

Class

WidgetBase
Base class for 'Field widget' plugin implementations.

Namespace

Drupal\Core\Field

Code

public static function deleteAjax(array &$form, FormStateInterface $form_state) {
    $button = $form_state->getTriggeringElement();
    return NestedArray::getValue($form, array_slice($button['#array_parents'], 0, -3));
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal