You are here

protected function WebformOptionsCustomListBuilder::buildUsedBy in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_options_custom/src/WebformOptionsCustomListBuilder.php \Drupal\webform_options_custom\WebformOptionsCustomListBuilder::buildUsedBy()

Build list of webforms that the webform custom options is used by.

Parameters

\Drupal\webform_options_custom\WebformOptionsCustomInterface $webform_options_custom: A webform options custom entity.

Return value

array Table data containing list of webforms that the webform custom options is used by.

1 call to WebformOptionsCustomListBuilder::buildUsedBy()
WebformOptionsCustomListBuilder::buildRow in modules/webform_options_custom/src/WebformOptionsCustomListBuilder.php
Builds a row for an entity in the entity listing.

File

modules/webform_options_custom/src/WebformOptionsCustomListBuilder.php, line 216

Class

WebformOptionsCustomListBuilder
Defines a class to build a listing of webform options custom entities.

Namespace

Drupal\webform_options_custom

Code

protected function buildUsedBy(WebformOptionsCustomInterface $webform_options_custom) {
  $links = [];
  $webforms = $this
    ->getStorage()
    ->getUsedByWebforms($webform_options_custom);
  foreach ($webforms as $id => $title) {
    $links[] = [
      '#type' => 'link',
      '#title' => $title,
      '#url' => Url::fromRoute('entity.webform.canonical', [
        'webform' => $id,
      ]),
      '#suffix' => '</br>',
    ];
  }
  return [
    'nowrap' => TRUE,
    'data' => $links,
  ];
}