Commit abceccfd by Carsten Brandt

improved APIdocs template by sorting all items

parent 0f7732e8
......@@ -2,6 +2,8 @@
use yii\apidoc\helpers\Markdown;
use yii\apidoc\models\ClassDoc;
use yii\helpers\ArrayHelper;
/**
* @var ClassDoc $type
* @var yii\web\View $this
......@@ -9,7 +11,10 @@ use yii\apidoc\models\ClassDoc;
if (empty($type->constants)) {
return;
} ?>
}
$constants = $type->constants;
ArrayHelper::multisort($constants, 'name');
?>
<div class="summary docConst">
<h2>Constants</h2>
......@@ -24,7 +29,7 @@ if (empty($type->constants)) {
<tr>
<th>Constant</th><th>Value</th><th>Description</th><th>Defined By</th>
</tr>
<?php foreach($type->constants as $constant): ?>
<?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>
......
......@@ -2,6 +2,8 @@
use yii\apidoc\helpers\Markdown;
use yii\apidoc\models\ClassDoc;
use yii\helpers\ArrayHelper;
/**
* @var ClassDoc $type
* @var yii\web\View $this
......@@ -10,7 +12,9 @@ use yii\apidoc\models\ClassDoc;
$events = $type->getNativeEvents();
if (empty($events)) {
return;
} ?>
}
ArrayHelper::multisort($events, 'name');
?>
<h2>Event Details</h2>
<?php foreach($events as $event): ?>
<div class="detailHeader h3" id="<?= $event->name.'-detail' ?>">
......
......@@ -2,6 +2,8 @@
use yii\apidoc\helpers\Markdown;
use yii\apidoc\models\ClassDoc;
use yii\helpers\ArrayHelper;
/**
* @var ClassDoc $type
* @var yii\web\View $this
......@@ -9,7 +11,10 @@ use yii\apidoc\models\ClassDoc;
if (empty($type->events)) {
return;
} ?>
}
$events = $type->events;
ArrayHelper::multisort($events, 'name');
?>
<div class="summary docEvent">
<h2>Events</h2>
......@@ -24,7 +29,7 @@ if (empty($type->events)) {
<tr>
<th>Event</th><th>Type</th><th>Description</th><th>Defined By</th>
</tr>
<?php foreach($type->events as $event): ?>
<?php foreach($events as $event): ?>
<tr<?= $event->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $event->name ?>">
<td><?= $this->context->subjectLink($event) ?></td>
<td><?= $this->context->typeLink($event->types) ?></td>
......
......@@ -3,6 +3,8 @@
use yii\apidoc\helpers\Markdown;
use yii\apidoc\models\ClassDoc;
use yii\apidoc\models\TraitDoc;
use yii\helpers\ArrayHelper;
/**
* @var ClassDoc|TraitDoc $type
* @var yii\web\View $this
......@@ -11,7 +13,9 @@ use yii\apidoc\models\TraitDoc;
$methods = $type->getNativeMethods();
if (empty($methods)) {
return;
} ?>
}
ArrayHelper::multisort($methods, 'name');
?>
<h2>Method Details</h2>
<?php foreach($methods as $method): ?>
......
......@@ -4,6 +4,8 @@ use yii\apidoc\helpers\Markdown;
use yii\apidoc\models\ClassDoc;
use yii\apidoc\models\InterfaceDoc;
use yii\apidoc\models\TraitDoc;
use yii\helpers\ArrayHelper;
/**
* @var ClassDoc|InterfaceDoc|TraitDoc $type
* @var boolean $protected
......@@ -28,7 +30,10 @@ if ($protected && count($type->getProtectedMethods()) == 0 || !$protected && cou
<tr>
<th>Method</th><th>Description</th><th>Defined By</th>
</tr>
<?php foreach($type->methods as $method): ?>
<?php
$methods = $type->methods;
ArrayHelper::multisort($methods, 'name');
foreach($methods as $method): ?>
<?php if($protected && $method->visibility == 'protected' || !$protected && $method->visibility != 'protected'): ?>
<tr<?= $method->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $method->name ?>()">
<td><?= $this->context->subjectLink($method, $method->name.'()') ?></td>
......
......@@ -3,6 +3,8 @@
use yii\apidoc\helpers\Markdown;
use yii\apidoc\models\ClassDoc;
use yii\apidoc\models\TraitDoc;
use yii\helpers\ArrayHelper;
/**
* @var ClassDoc|TraitDoc $type
* @var yii\web\View $this
......@@ -11,7 +13,9 @@ use yii\apidoc\models\TraitDoc;
$properties = $type->getNativeProperties();
if (empty($properties)) {
return;
} ?>
}
ArrayHelper::multisort($properties, 'name');
?>
<h2>Property Details</h2>
<?php foreach($properties as $property): ?>
......
......@@ -3,6 +3,8 @@
use yii\apidoc\helpers\Markdown;
use yii\apidoc\models\ClassDoc;
use yii\apidoc\models\TraitDoc;
use yii\helpers\ArrayHelper;
/**
* @var ClassDoc|TraitDoc $type
* @var boolean $protected
......@@ -28,7 +30,10 @@ if ($protected && count($type->getProtectedProperties()) == 0 || !$protected &&
<tr>
<th>Property</th><th>Type</th><th>Description</th><th>Defined By</th>
</tr>
<?php foreach($type->properties as $property): ?>
<?php
$properties = $type->properties;
ArrayHelper::multisort($properties, 'name');
foreach($properties as $property): ?>
<?php if($protected && $property->visibility == 'protected' || !$protected && $property->visibility != 'protected'): ?>
<tr<?= $property->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $property->name ?>">
<td><?= $this->context->subjectLink($property) ?></td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment