Select Git revision
action-menu-single.php
Forked from
Stud.IP / Stud.IP
Source project has a limited visibility.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
action-menu-single.php 1.19 KiB
<?php
/**
* @var array<array{
* type: string,
* label: string,
* link?: string,
* name?: string,
* object?: MultiPersonSearch,
* icon: Icon,
* attributes: array
* }> $actions
*/
?>
<? foreach ($actions as $action): ?>
<? if ($action['type'] === 'link'): ?>
<a href="<?= htmlReady($action['link']) ?>" <?= arrayToHtmlAttributes($action['attributes'] + ['title' => $action['label']]) ?>>
<? if ($action['icon']): ?>
<?= $action['icon']->asImg() ?>
<? else: ?>
<?= htmlReady($action['label']) ?>
<? endif ?>
</a>
<? elseif ($action['type'] === 'button'): ?>
<? if ($action['icon']): ?>
<?= $action['icon']->asInput($action['attributes'] + ['name' => $action['name'], 'title' => $action['label']]) ?>
<? else: ?>
<button name="<?= htmlReady($action['name']) ?>" <?= arrayToHtmlAttributes($action['attributes']) ?>>
<?= htmlReady($action['label']) ?>
</button>
<? endif ?>
<? elseif ($action['type'] === 'multi-person-search'): ?>
<?= $action['object']->render(false) ?>
<? endif ?>
<? endforeach ?>