public function WebformEditorialController::libraries in Webform 8.5
Returns webform libraries.
Return value
array A renderable array containing webform libraries editorial.
1 string reference to 'WebformEditorialController::libraries'
- webform_editorial.routing.yml in modules/
webform_editorial/ webform_editorial.routing.yml - modules/webform_editorial/webform_editorial.routing.yml
File
- modules/
webform_editorial/ src/ Controller/ WebformEditorialController.php, line 329
Class
- WebformEditorialController
- Provides route responses for webform editorial.
Namespace
Drupal\webform_editorial\ControllerCode
public function libraries() {
// Header.
$header = [
[
'data' => $this
->t('Name'),
'width' => '10%',
],
[
'data' => $this
->t('Title'),
'width' => '10%',
],
[
'data' => $this
->t('Description'),
'width' => '40%',
],
[
'data' => $this
->t('Notes'),
'width' => '40%',
],
];
// Rows.
$rows = [];
$libraries = $this->librariesManager
->getLibraries();
foreach ($libraries as $name => $library) {
$rows[] = [
'data' => [
[
'data' => $name,
],
[
'data' => '<a href="' . $library['homepage_url']
->toString() . '">' . $library['title'] . '</a>',
],
[
'data' => $library['description'],
],
[
'data' => $library['notes'],
],
],
];
}
$build = $this
->buildTable('Webform: Libraries editorial', $header, $rows);
return $this
->response($build);
}