protected function WebformOptionsListBuilder::buildUsedBy in Webform 8.5
Same name and namespace in other branches
- 6.x src/WebformOptionsListBuilder.php \Drupal\webform\WebformOptionsListBuilder::buildUsedBy()
Build list of webforms and composite elements that the webform options is used by.
Parameters
\Drupal\webform\WebformOptionsInterface $webform_options: A webform options entity.
Return value
array Table data containing list of webforms and composite elements that the webform options is used by.
1 call to WebformOptionsListBuilder::buildUsedBy()
- WebformOptionsListBuilder::buildRow in src/
WebformOptionsListBuilder.php - Builds a row for an entity in the entity listing.
File
- src/
WebformOptionsListBuilder.php, line 190
Class
- WebformOptionsListBuilder
- Defines a class to build a listing of webform options entities.
Namespace
Drupal\webformCode
protected function buildUsedBy(WebformOptionsInterface $webform_options) {
$links = [];
$webforms = $this
->getStorage()
->getUsedByWebforms($webform_options);
foreach ($webforms as $id => $title) {
$links[] = [
'#type' => 'link',
'#title' => $title,
'#url' => Url::fromRoute('entity.webform.canonical', [
'webform' => $id,
]),
'#suffix' => '</br>',
];
}
$elements = $this
->getStorage()
->getUsedByCompositeElements($webform_options);
foreach ($elements as $id => $title) {
$links[] = [
'#markup' => $title,
'#suffix' => '</br>',
];
}
return [
'nowrap' => TRUE,
'data' => $links,
];
}