public static function WebformElementHelper::merge in Webform 8.5
Same name and namespace in other branches
- 6.x src/Utility/WebformElementHelper.php \Drupal\webform\Utility\WebformElementHelper::merge()
Merge element properties.
Parameters
array $elements: An array of elements.
array $source_elements: An array of elements to be merged.
3 calls to WebformElementHelper::merge()
- WebformElementHelper::applyTranslation in src/
Utility/ WebformElementHelper.php - Apply translation to element.
- WebformTranslationManager::getTranslationElements in src/
WebformTranslationManager.php - Get flattened associative array of translated element properties.
- _webform_form_config_translate_add_form_validate in includes/
webform.translation.inc - Validate callback; Validates and cleanups webform elements.
File
- src/
Utility/ WebformElementHelper.php, line 520
Class
- WebformElementHelper
- Helper class webform element methods.
Namespace
Drupal\webform\UtilityCode
public static function merge(array &$elements, array $source_elements) {
foreach ($elements as $key => &$element) {
if (!isset($source_elements[$key])) {
continue;
}
$source_element = $source_elements[$key];
if (gettype($element) !== gettype($source_element)) {
continue;
}
if (is_array($element)) {
self::merge($element, $source_element);
}
elseif (is_scalar($element)) {
$elements[$key] = $source_element;
}
}
}