You are here

public static function MobileNumber::getTriggeringElementParent in Mobile Number 8

Same name and namespace in other branches
  1. 2.0.x src/Element/MobileNumber.php \Drupal\mobile_number\Element\MobileNumber::getTriggeringElementParent()

Get mobile number form element based on currently pressed form button.

Parameters

array $complete_form: Form array.

\Drupal\Core\Form\FormStateInterface $form_state: Form state.

Return value

mixed Mobile number form element.

1 call to MobileNumber::getTriggeringElementParent()
MobileNumber::verifyAjax in src/Element/MobileNumber.php
Mobile number element ajax callback.

File

src/Element/MobileNumber.php, line 496

Class

MobileNumber
Provides a form input element for entering an email address.

Namespace

Drupal\mobile_number\Element

Code

public static function getTriggeringElementParent(array $complete_form, FormStateInterface $form_state) {
  $triggering_element = $form_state
    ->getTriggeringElement();
  $parents = $triggering_element['#array_parents'];
  array_pop($parents);
  $element = NestedArray::getValue($complete_form, $parents);
  return $element;
}