You are here

public function WebformImageSelect::preview in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_image_select/src/Plugin/WebformElement/WebformImageSelect.php \Drupal\webform_image_select\Plugin\WebformElement\WebformImageSelect::preview()

Generate a renderable preview of the element.

Return value

array A renderable preview of the element.

Overrides OptionsBase::preview

File

modules/webform_image_select/src/Plugin/WebformElement/WebformImageSelect.php, line 224

Class

WebformImageSelect
Provides a 'image_select' element.

Namespace

Drupal\webform_image_select\Plugin\WebformElement

Code

public function preview() {
  return parent::preview() + [
    '#show_label' => TRUE,
    '#images' => [
      'dog_1' => [
        'text' => 'Dog 1',
        'src' => 'https://www.placedog.net/80/100',
      ],
      'dog_2' => [
        'text' => 'Dog 2',
        'src' => 'https://www.placedog.net/100/100',
      ],
      'dog_3' => [
        'text' => 'Dog 3',
        'src' => 'https://www.placedog.net/120/100',
      ],
    ],
  ];
}