public function WebformTermsOfService::preview in Webform 6.x
Same name and namespace in other branches
- 8.5 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\WebformElementCode
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>',
];
}