Skip to content
Snippets Groups Projects
Select Git revision
  • 215a216ef3bb6525fd54b4d8a1f5de4e7c6bfa17
  • main default protected
  • step-3263
  • feature/plugins-cli
  • feature/vite
  • step-2484-peerreview
  • biest/issue-5051
  • tests/simplify-jsonapi-tests
  • fix/typo-in-1a70031
  • feature/broadcasting
  • database-seeders-and-factories
  • feature/peer-review-2
  • feature-feedback-jsonapi
  • feature/peerreview
  • feature/balloon-plus
  • feature/stock-images-unsplash
  • tic-2588
  • 5.0
  • 5.2
  • biest/unlock-blocks
  • biest-1514
21 results

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 ?>