protected function LoginDestination::renderItemList in Login Destination 8.2
Same name and namespace in other branches
- 8 src/Entity/LoginDestination.php \Drupal\login_destination\Entity\LoginDestination::renderItemList()
Render item list.
Parameters
array $array: List of items.
string $empty_message: Default empty message.
Return value
string|\Drupal\Core\Render\Markup List of items or empty message.
3 calls to LoginDestination::renderItemList()
- LoginDestination::viewPages in src/
Entity/ LoginDestination.php - Prepare list of pages for displaying.
- LoginDestination::viewRoles in src/
Entity/ LoginDestination.php - Prepare list of roles for displaying.
- LoginDestination::viewTriggers in src/
Entity/ LoginDestination.php - Prepare list of triggers for displaying.
File
- src/
Entity/ LoginDestination.php, line 336
Class
- LoginDestination
- Defines a login destination configuration entity.
Namespace
Drupal\login_destination\EntityCode
protected function renderItemList(array $array, $empty_message) {
$items = [];
foreach ($array as $value) {
if (!empty($value)) {
$items[] = Html::escape($value);
}
}
if (count($items) === 0) {
return $empty_message;
}
$item_list = [
'#theme' => 'item_list',
'#items' => $items,
'#list_type' => 'ul',
];
return \Drupal::service('renderer')
->render($item_list);
}