constSummary.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. use yii\apidoc\helpers\ApiMarkdown;
  3. use yii\apidoc\models\ClassDoc;
  4. use yii\helpers\ArrayHelper;
  5. /* @var $type ClassDoc */
  6. /* @var $this yii\web\View */
  7. /* @var $renderer \yii\apidoc\templates\html\ApiRenderer */
  8. $renderer = $this->context;
  9. if (empty($type->constants)) {
  10. return;
  11. }
  12. $constants = $type->constants;
  13. ArrayHelper::multisort($constants, 'name');
  14. ?>
  15. <div class="summary doc-const">
  16. <h2>Constants</h2>
  17. <p><a href="#" class="toggle">Hide inherited constants</a></p>
  18. <table class="summary-table table table-striped table-bordered table-hover">
  19. <colgroup>
  20. <col class="col-const" />
  21. <col class="col-value" />
  22. <col class="col-description" />
  23. <col class="col-defined" />
  24. </colgroup>
  25. <tr>
  26. <th>Constant</th><th>Value</th><th>Description</th><th>Defined By</th>
  27. </tr>
  28. <?php foreach ($constants as $constant): ?>
  29. <tr<?= $constant->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $constant->name ?>">
  30. <td id="<?= $constant->name ?>-detail"><?= $constant->name ?></td>
  31. <td><?= $constant->value ?></td>
  32. <td><?= ApiMarkdown::process($constant->shortDescription . "\n" . $constant->description, $constant->definedBy, true) ?>
  33. <?php if (!empty($constant->deprecatedSince) || !empty($constant->deprecatedReason)): ?>
  34. <strong>Deprecated <?php
  35. if (!empty($constant->deprecatedSince)) { echo 'since version ' . $constant->deprecatedSince . ': '; }
  36. if (!empty($constant->deprecatedReason)) { echo ApiMarkdown::process($constant->deprecatedReason, $type, true); }
  37. ?></strong>
  38. <?php endif; ?>
  39. </td>
  40. <td><?= $renderer->createTypeLink($constant->definedBy) ?></td>
  41. </tr>
  42. <?php endforeach; ?>
  43. </table>
  44. </div>