You are here

public function WebformHorizontalRule::buildText in Webform 6.x

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

Build an element as text element.

Parameters

array $element: An element.

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

array $options: An array of options.

Return value

array A render array representing an element as text.

Overrides WebformDisplayOnTrait::buildText

File

src/Plugin/WebformElement/WebformHorizontalRule.php, line 81

Class

WebformHorizontalRule
Provides a 'webform_horizontal_rule' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function buildText(array $element, WebformSubmissionInterface $webform_submission, array $options = []) {

  // Hide element if it should not be displayed on 'view'.
  if (!$this
    ->isDisplayOn($element, WebformElementDisplayOnInterface::DISPLAY_ON_VIEW)) {
    return [];
  }
  return [
    '#plain_text' => PHP_EOL . '---' . PHP_EOL,
  ];
}