You are here

public static function WebformMultiple::convertValueToItem in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Element/WebformMultiple.php \Drupal\webform\Element\WebformMultiple::convertValueToItem()

Convert value array containing (elements or _item_ and weight) to an item.

Parameters

array $value: The multiple value array.

Return value

array An item array.

2 calls to WebformMultiple::convertValueToItem()
WebformMultiple::convertValuesToItems in src/Element/WebformMultiple.php
Convert an array containing of values (elements or _item_ and weight) to an array of items.
WebformMultiple::validateUniqueKeys in src/Element/WebformMultiple.php
Validate composite element has unique keys.

File

src/Element/WebformMultiple.php, line 1023

Class

WebformMultiple
Provides a webform element to assist in creation of multiple elements.

Namespace

Drupal\webform\Element

Code

public static function convertValueToItem(array $value) {
  if (isset($value['_item_'])) {
    return $value['_item_'];
  }
  else {

    // Get hidden (#access: FALSE) elements in the '_handle_' column and
    // add them to the $value.
    // @see \Drupal\webform\Element\WebformMultiple::buildElementRow
    if (isset($value['_hidden_']) && is_array($value['_hidden_'])) {
      $value += $value['_hidden_'];
    }
    unset($value['weight'], $value['_operations_'], $value['_hidden_']);
    return $value;
  }
}