From 6cf257d4b0ecf3f75c51a07974b8e14e023b12b9 Mon Sep 17 00:00:00 2001 From: kenorb Date: Wed, 23 Aug 2017 22:14:36 +0100 Subject: [PATCH] Issue #2901761 by kenorb: Computed field fails to render a form in block --- src/Element/WebformComputedBase.php | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/Element/WebformComputedBase.php b/src/Element/WebformComputedBase.php index 5d934279..6c7bed52 100644 --- a/src/Element/WebformComputedBase.php +++ b/src/Element/WebformComputedBase.php @@ -68,10 +68,9 @@ abstract class WebformComputedBase extends FormElement { public static function processWebformComputed(&$element, FormStateInterface $form_state, &$complete_form) { $webform_submission = static::getWebformSubmission($element, $form_state); if ($webform_submission) { - $value = static::processValue($element, $webform_submission);; // Display markup. - $element['value']['#markup'] = $value; + $element['value']['#children'] = $element['#value']; // Include hidden element so that computed value will be available to // conditions (#states). @@ -94,21 +93,6 @@ abstract class WebformComputedBase extends FormElement { return $element; } - /** - * Process computed value. - * - * @param array $element - * The element. - * @param \Drupal\webform\WebformSubmissionInterface $webform_submission - * A webform submission. - * - * @return array|string - * The string with tokens replaced. - */ - public static function processValue(array $element, WebformSubmissionInterface $webform_submission) { - return $element['#value']; - } - /** * Get an element's value mode/type. * -- 2.14.1