public function WebformSubmissionListBuilder::render in Webform 6.x
Same name and namespace in other branches
- 8.5 src/WebformSubmissionListBuilder.php \Drupal\webform\WebformSubmissionListBuilder::render()
Builds the entity listing as renderable array for table.html.twig.
@todo Add a link to add a new item to the #empty text.
Overrides EntityListBuilder::render
File
- src/
WebformSubmissionListBuilder.php, line 422
Class
- WebformSubmissionListBuilder
- Provides a list controller for webform submission entity.
Namespace
Drupal\webformCode
public function render() {
$build = [];
// Set user specific page title.
if ($this->webform && $this->account) {
$t_args = [
'%webform' => $this->webform
->label(),
'%user' => $this->account
->getDisplayName(),
];
if ($this->draft) {
$build['#title'] = $this
->t('Drafts for %webform for %user', $t_args);
}
else {
$build['#title'] = $this
->t('Submissions to %webform for %user', $t_args);
}
}
elseif ($this->account) {
$build['#title'] = $this->account
->getDisplayName();
}
// Display warning when the webform has a submission but saving of results.
// are disabled.
if ($this->webform && $this->webform
->getSetting('results_disabled')) {
$this->messageManager
->display(WebformMessageManagerInterface::FORM_SAVE_EXCEPTION, 'warning');
}
$build += $this
->buildSubmissionViewsMenu();
if ($this->submissionView) {
$build += $this
->buildSubmissionViews();
}
else {
$build += $this
->buildEntityList();
}
$build['#attached']['library'][] = 'webform/webform.admin';
return $build;
}