public function WebformImageSelect::preview in Webform 8.5
Same name and namespace in other branches
- 6.x 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 199
Class
- WebformImageSelect
- Provides a 'image_select' element.
Namespace
Drupal\webform_image_select\Plugin\WebformElementCode
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',
],
],
];
}