public function WebformLikert::preview in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformElement/WebformLikert.php \Drupal\webform\Plugin\WebformElement\WebformLikert::preview()
Generate a renderable preview of the element.
Return value
array A renderable preview of the element.
Overrides WebformElementBase::preview
File
- src/
Plugin/ WebformElement/ WebformLikert.php, line 352
Class
- WebformLikert
- Provides a 'likert' element.
Namespace
Drupal\webform\Plugin\WebformElementCode
public function preview() {
return parent::preview() + [
'#questions' => [
'q1' => $this
->t('Please answer question 1?'),
'q2' => $this
->t('How about now answering question 2?'),
'q3' => $this
->t('Finally, here is question 3?'),
],
'#answers' => [
'1' => '1',
'2' => '2',
'3' => '3',
],
];
}