You are here

public function WebformLocationBase::initialize in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/WebformLocationBase.php \Drupal\webform\Plugin\WebformElement\WebformLocationBase::initialize()

Initialize an element to be displayed, rendered, or exported.

Parameters

array $element: An element.

Overrides WebformCompositeBase::initialize

File

src/Plugin/WebformElement/WebformLocationBase.php, line 64

Class

WebformLocationBase
Provides a base 'location' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function initialize(array &$element) {

  // Hide all composite elements by default.
  $composite_elements = $this
    ->getCompositeElements();
  foreach ($composite_elements as $composite_key => $composite_element) {
    if ($composite_key !== 'value' && !isset($element['#' . $composite_key . '__access'])) {
      $element['#' . $composite_key . '__access'] = FALSE;
    }
  }
  parent::initialize($element);
}