You are here

public function WebformLikert::preview in Webform 8.5

Same name and namespace in other branches
  1. 6.x 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\WebformElement

Code

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',
    ],
  ];
}