You are here

public static function EntityqueueDragtableWidget::removeAjax in Entityqueue 8

Ajax callback for the "Remove" button.

File

src/Plugin/Field/FieldWidget/EntityqueueDragtableWidget.php, line 209

Class

EntityqueueDragtableWidget
Plugin implementation of the 'entityqueue_dragtable' widget.

Namespace

Drupal\entityqueue\Plugin\Field\FieldWidget

Code

public static function removeAjax(array $form, FormStateInterface $form_state) {
  $button = $form_state
    ->getTriggeringElement();

  // Go two levels up in the form, to the widget container.
  $element = NestedArray::getValue($form, array_slice($button['#array_parents'], 0, -2));
  return $element;
}