propertySummary.php 1.64 KB
Newer Older
1 2
<?php

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

8 9 10 11
/* @var $type ClassDoc|TraitDoc */
/* @var $protected boolean */
/* @var $this yii\web\View */
/* @var $renderer \yii\apidoc\templates\html\ApiRenderer */
12

13 14
$renderer = $this->context;

Carsten Brandt committed
15
if ($protected && count($type->getProtectedProperties()) == 0 || !$protected && count($type->getPublicProperties()) == 0) {
16
    return;
17 18
} ?>

Carsten Brandt committed
19
<div class="summary doc-property">
20 21 22 23
<h2><?= $protected ? 'Protected Properties' : 'Public Properties' ?></h2>

<p><a href="#" class="toggle">Hide inherited properties</a></p>

Carsten Brandt committed
24
<table class="summary-table table table-striped table-bordered table-hover">
25
<colgroup>
26 27 28 29
    <col class="col-property" />
    <col class="col-type" />
    <col class="col-description" />
    <col class="col-defined" />
30 31 32 33
</colgroup>
<tr>
  <th>Property</th><th>Type</th><th>Description</th><th>Defined By</th>
</tr>
34 35 36
<?php
$properties = $type->properties;
ArrayHelper::multisort($properties, 'name');
Alexander Mohorev committed
37
foreach ($properties as $property): ?>
38 39 40 41 42 43 44 45
    <?php if ($protected && $property->visibility == 'protected' || !$protected && $property->visibility != 'protected'): ?>
    <tr<?= $property->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $property->name ?>">
        <td><?= $renderer->createSubjectLink($property) ?></td>
        <td><?= $renderer->createTypeLink($property->types) ?></td>
        <td><?= ApiMarkdown::process($property->shortDescription, $property->definedBy, true) ?></td>
        <td><?= $renderer->createTypeLink($property->definedBy) ?></td>
    </tr>
    <?php endif; ?>
46 47
<?php endforeach; ?>
</table>
48
</div>