api.php 1.92 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
<?php
use yii\apidoc\templates\bootstrap\SideNavWidget;
use yii\helpers\StringHelper;

/**
 * @var yii\web\View $this
 */

$this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>

<div class="row">
	<div class="col-md-2">
		<?php
14
		$types = $this->context->getNavTypes(isset($type) ? $type : null, $types);
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
		ksort($types);
		$nav = [];
		foreach($types as $i=>$class) {
			$namespace = $class->namespace;
			if (empty($namespace)) {
				$namespace = 'Not namespaced classes';
			}
			if (!isset($nav[$namespace])) {
				$nav[$namespace] = [
					'label' => $namespace,
					'url' => '#',
					'items' => [],
				];
			}
			$nav[$namespace]['items'][] = [
				'label' => StringHelper::basename($class->name),
				'url' => './' . $this->context->generateUrl($class->name),
				'active' => isset($type) && ($class->name == $type->name),
			];
		} ?>
		<?= SideNavWidget::widget([
			'id' => 'navigation',
			'items' => $nav,
			'view' => $this,
		])?>
	</div>
	<div class="col-md-9" role="main">
		<?= $content ?>
	</div>
</div>

<script type="text/javascript">
	/*<![CDATA[*/
	$("a.toggle").on('click', function() {
		var $this = $(this);
		if ($this.hasClass('properties-hidden')) {
			$this.text($this.text().replace(/Show/,'Hide'));
			$this.parents(".summary").find(".inherited").show();
			$this.removeClass('properties-hidden');
		} else {
			$this.text($this.text().replace(/Hide/,'Show'));
			$this.parents(".summary").find(".inherited").hide();
			$this.addClass('properties-hidden');
		}
		return false;
	});
	/*
	 $(".sourceCode a.show").toggle(function(){
	 $(this).text($(this).text().replace(/show/,'hide'));
	 $(this).parents(".sourceCode").find("div.code").show();
	 },function(){
	 $(this).text($(this).text().replace(/hide/,'show'));
	 $(this).parents(".sourceCode").find("div.code").hide();
	 });
	 $("a.sourceLink").click(function(){
	 $(this).attr('target','_blank');
	 });
	 */
	/*]]>*/
</script>

<?php $this->endContent(); ?>