public function WebformOptionsCustomDeleteForm::getDetails in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_options_custom/src/WebformOptionsCustomDeleteForm.php \Drupal\webform_options_custom\WebformOptionsCustomDeleteForm::getDetails()
Returns details to display.
Return value
array A renderable array containing details.
Overrides WebformConfigEntityDeleteFormBase::getDetails
File
- modules/
webform_options_custom/ src/ WebformOptionsCustomDeleteForm.php, line 33
Class
- WebformOptionsCustomDeleteForm
- Provides a delete webform custom options form.
Namespace
Drupal\webform_options_customCode
public function getDetails() {
/** @var \Drupal\webform_options_custom\WebformOptionsCustomInterface $webform_options_custom */
$webform_options_custom = $this->entity;
/** @var \Drupal\webform_options_custom\WebformOptionsCustomStorageInterface $webform_options_custom_storage */
$webform_options_custom_storage = $this->entityTypeManager
->getStorage('webform_options_custom');
$t_args = [
'%label' => $this
->getEntity()
->label(),
'@entity-type' => $this
->getEntity()
->getEntityType()
->getSingularLabel(),
];
$details = [];
if ($used_by_webforms = $webform_options_custom_storage
->getUsedByWebforms($webform_options_custom)) {
$details['used_by_composite_elements'] = [
'title' => [
'#markup' => $this
->t('%label is used by the below webform(s).', $t_args),
],
'list' => [
'#theme' => 'item_list',
'#items' => $used_by_webforms,
],
];
}
if ($details) {
return [
'#type' => 'details',
'#title' => $this
->t('Webforms affected'),
] + $details;
}
else {
return [];
}
}