You are here

public function WebformElementBase::finalize in Webform 6.x

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

Finalize an element to be rendered within a webform.

Parameters

array $element: An element.

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission. Webform submission is optional since it is not used by composite sub elements.

Overrides WebformElementInterface::finalize

See also

\Drupal\webform\Element\WebformCompositeBase::processWebformComposite

1 call to WebformElementBase::finalize()
WebformEntityPrintAttachment::finalize in modules/webform_entity_print_attachment/src/Plugin/WebformElement/WebformEntityPrintAttachment.php
Finalize an element to be rendered within a webform.
1 method overrides WebformElementBase::finalize()
WebformEntityPrintAttachment::finalize in modules/webform_entity_print_attachment/src/Plugin/WebformElement/WebformEntityPrintAttachment.php
Finalize an element to be rendered within a webform.

File

src/Plugin/WebformElementBase.php, line 812

Class

WebformElementBase
Provides a base class for a webform element.

Namespace

Drupal\webform\Plugin

Code

public function finalize(array &$element, WebformSubmissionInterface $webform_submission = NULL) {

  // Set element's #element_validate callback so that is not replaced when
  // we append additional #pre_render callbacks.
  $this
    ->setElementDefaultCallback($element, 'pre_render');
  $this
    ->prepareElementPreRenderCallbacks($element, $webform_submission);

  // Prepare composite element.
  $this
    ->prepareCompositeFormElement($element);

  // Prepare multiple element.
  $this
    ->prepareMultipleWrapper($element);

  // Prepare #states and flexbox wrapper.
  $this
    ->prepareWrapper($element);

  // Set hidden element #after_build handler.
  $this
    ->setElementDefaultCallback($element, 'after_build');
  $element['#after_build'][] = [
    get_class($this),
    'hiddenElementAfterBuild',
  ];
}