You are here

public static function BatOptionsCombined::removeItemAjax in Booking and Availability Management Tools for Drupal 8

File

modules/bat_options/src/Plugin/Field/FieldWidget/BatOptionsCombined.php, line 254
Contains \Drupal\bat_options\Plugin\Field\FieldWidget\BatOptionsCombined.

Class

BatOptionsCombined
Plugin annotation @FieldWidget( id = "bat_options_combined", label = @Translation("Combined text field'"), field_types = { "bat_options" } )

Namespace

Drupal\bat_options\Plugin\Field\FieldWidget

Code

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

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