You are here

public function WebformCompositeBase::getInitializedCompositeElement in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformElement/WebformCompositeBase.php \Drupal\webform\Plugin\WebformElement\WebformCompositeBase::getInitializedCompositeElement()

Get initialized composite element.

Parameters

array $element: A composite element.

string $composite_key: (Optional) Composite sub element key.

Return value

array The initialized composite element or a specific composite sub element key.

See also

\Drupal\webform\Plugin\WebformElement\WebformCompositeBase::initialize

13 calls to WebformCompositeBase::getInitializedCompositeElement()
WebformCompositeBase::buildExportHeader in src/Plugin/WebformElement/WebformCompositeBase.php
Build an element's export header.
WebformCompositeBase::buildExportRecord in src/Plugin/WebformElement/WebformCompositeBase.php
Build an element's export row.
WebformCompositeBase::formatComposite in src/Plugin/WebformElement/WebformCompositeBase.php
Format a composite's sub element's value as HTML or plain text.
WebformCompositeBase::formatCompositeHtmlItems in src/Plugin/WebformElement/WebformCompositeBase.php
Format a composite as a list of HTML items.
WebformCompositeBase::formatCompositeTextItems in src/Plugin/WebformElement/WebformCompositeBase.php
Format a composite as a list of plain text items.

... See full list

File

src/Plugin/WebformElement/WebformCompositeBase.php, line 1294

Class

WebformCompositeBase
Provides a base for composite elements.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function getInitializedCompositeElement(array $element, $composite_key = NULL) {
  $composite_elements = $element['#webform_composite_elements'];
  if (isset($composite_key)) {
    return isset($composite_elements[$composite_key]) ? $composite_elements[$composite_key] : NULL;
  }
  else {
    return $composite_elements;
  }
}