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
 * @var ClassDoc|TraitDoc $type
10 11
 * @var boolean $protected
 * @var yii\web\View $this
12
 * @var \yii\apidoc\templates\html\ApiRenderer $renderer
13 14
 */

15 16
$renderer = $this->context;

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

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

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

Carsten Brandt committed
26
<table class="summary-table table table-striped table-bordered table-hover">
27
<colgroup>
28 29 30 31
    <col class="col-property" />
    <col class="col-type" />
    <col class="col-description" />
    <col class="col-defined" />
32 33 34 35
</colgroup>
<tr>
  <th>Property</th><th>Type</th><th>Description</th><th>Defined By</th>
</tr>
36 37 38
<?php
$properties = $type->properties;
ArrayHelper::multisort($properties, 'name');
Alexander Mohorev committed
39
foreach ($properties as $property): ?>
40 41 42 43 44 45 46 47
    <?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; ?>
48 49
<?php endforeach; ?>
</table>
50
</div>