You are here

public function ShsTermSelect::getConfigurationFormProperties in Webform Simple Hierarchical Select 8

Get an associative array of element properties from configuration webform.

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 An associative array of element properties.

Overrides WebformElementBase::getConfigurationFormProperties

File

src/Plugin/WebformElement/ShsTermSelect.php, line 229

Class

ShsTermSelect
Provides a 'webform_shs_term_select' Webform element.

Namespace

Drupal\webform_shs\Plugin\WebformElement

Code

public function getConfigurationFormProperties(array &$form, FormStateInterface $form_state) {

  // The webform properties/form/configuration API doesn't support complex
  // form structures. Extract the depth labels out of the form state directly.
  $properties = parent::getConfigurationFormProperties($form, $form_state);
  $depth_labels = [];
  foreach ($form_state
    ->getCompleteFormState()
    ->getValue('depth_labels') as $key => $value) {
    if (is_numeric($key) && !empty($value)) {
      $depth_labels[] = $value;
    }
  }
  $properties['#depth_labels'] = $depth_labels;
  return $properties;
}