public function WebformTable::preview in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformElement/WebformTable.php \Drupal\webform\Plugin\WebformElement\WebformTable::preview()
Generate a renderable preview of the element.
Return value
array A renderable preview of the element.
Overrides WebformElementBase::preview
File
- src/
Plugin/ WebformElement/ WebformTable.php, line 257
Class
- WebformTable
- Provides a 'webform_table' element.
Namespace
Drupal\webform\Plugin\WebformElementCode
public function preview() {
return [
'#type' => 'table',
'#header' => [
$this
->t('Header 1'),
$this
->t('Header 2'),
],
'#rows' => [
[
'Row 1 - Col 1',
'Row 1 - Col 2',
],
[
'Row 2 - Col 1',
'Row 2 - Col 2',
],
[
'Row 3 - Col 1',
'Row 3 - Col 2',
],
],
];
}