You are here

public function WebformTermsOfService::preview in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformElement/WebformTermsOfService.php \Drupal\webform\Plugin\WebformElement\WebformTermsOfService::preview()

Generate a renderable preview of the element.

Return value

array A renderable preview of the element.

Overrides WebformElementBase::preview

File

src/Plugin/WebformElement/WebformTermsOfService.php, line 90

Class

WebformTermsOfService
Provides a 'terms_of_service' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function preview() {
  return [
    '#type' => $this
      ->getTypeName(),
    '#title' => $this
      ->t('I agree to the {terms of service}.'),
    '#required' => TRUE,
    '#terms_type' => WebformTermsOfServiceElement::TERMS_SLIDEOUT,
    '#terms_content' => '<em>' . $this
      ->t('These are the terms of service.') . '</em>',
  ];
}