You are here

public static function CivicrmOptions::ajaxCallback in Webform CiviCRM Integration 8.5

Ajax callback.

Parameters

array $form: An associative array containing the structure of the form.

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

Return value

array The properties element.

File

src/Plugin/WebformElement/CivicrmOptions.php, line 225

Class

CivicrmOptions
Provides a 'civicrm_options' element.

Namespace

Drupal\webform_civicrm\Plugin\WebformElement

Code

public static function ajaxCallback(array $form, FormStateInterface $form_state) {
  $radio = $form_state
    ->getTriggeringElement();
  $element = NestedArray::getValue($form, array_slice($radio['#array_parents'], 0, -2));
  return $element;
}