constSummary.php 1.38 KB
Newer Older
1 2
<?php

3
use yii\apidoc\helpers\ApiMarkdown;
4
use yii\apidoc\models\ClassDoc;
5 6
use yii\helpers\ArrayHelper;

7 8 9
/* @var $type ClassDoc */
/* @var $this yii\web\View */
/* @var $renderer \yii\apidoc\templates\html\ApiRenderer */
10

11 12
$renderer = $this->context;

Carsten Brandt committed
13
if (empty($type->constants)) {
14
    return;
15 16 17 18
}
$constants = $type->constants;
ArrayHelper::multisort($constants, 'name');
?>
Carsten Brandt committed
19
<div class="summary doc-const">
20
    <h2>Constants</h2>
21

22
    <p><a href="#" class="toggle">Hide inherited constants</a></p>
23

24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
    <table class="summary-table table table-striped table-bordered table-hover">
    <colgroup>
        <col class="col-const" />
        <col class="col-value" />
        <col class="col-description" />
        <col class="col-defined" />
    </colgroup>
    <tr>
        <th>Constant</th><th>Value</th><th>Description</th><th>Defined By</th>
    </tr>
    <?php foreach ($constants as $constant): ?>
        <tr<?= $constant->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $constant->name ?>">
          <td><?= $constant->name ?><a name="<?= $constant->name ?>-detail"></a></td>
          <td><?= $constant->value ?></td>
          <td><?= ApiMarkdown::process($constant->shortDescription . "\n" . $constant->description, $constant->definedBy, true) ?></td>
          <td><?= $renderer->createTypeLink($constant->definedBy) ?></td>
        </tr>
    <?php endforeach; ?>
    </table>
</div>