public function WebformCustomComposite::preview in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformElement/WebformCustomComposite.php \Drupal\webform\Plugin\WebformElement\WebformCustomComposite::preview()
Generate a renderable preview of the element.
Return value
array A renderable preview of the element.
Overrides WebformElementBase::preview
File
- src/
Plugin/ WebformElement/ WebformCustomComposite.php, line 167
Class
- WebformCustomComposite
- Provides a custom composite element.
Namespace
Drupal\webform\Plugin\WebformElementCode
public function preview() {
return [
'#type' => $this
->getTypeName(),
'#title' => $this
->getPluginLabel(),
'#element' => [
'name' => [
'#type' => 'textfield',
'#title' => 'Name',
'#title_display' => 'invisible',
],
'gender' => [
'#type' => 'select',
'#title' => 'Gender',
'#title_display' => 'invisible',
'#options' => [
'Male' => $this
->t('Male'),
'Female' => $this
->t('Female'),
],
],
],
];
}