mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-04 06:37:55 +08:00 
			
		
		
		
	@ -11,7 +11,7 @@ use yii\helpers\StringHelper;
 | 
				
			|||||||
/** @var $renderer ApiRenderer */
 | 
					/** @var $renderer ApiRenderer */
 | 
				
			||||||
$renderer = $this->context;
 | 
					$renderer = $this->context;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>
 | 
					$this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php', isset($type) ? ['type' => $type] : []); ?>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="row">
 | 
					<div class="row">
 | 
				
			||||||
    <div class="col-md-3">
 | 
					    <div class="col-md-3">
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,17 @@ use yii\apidoc\templates\bootstrap\SideNavWidget;
 | 
				
			|||||||
/* @var $content string */
 | 
					/* @var $content string */
 | 
				
			||||||
/* @var $chapters array */
 | 
					/* @var $chapters array */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>
 | 
					if (isset($currentFile)) {
 | 
				
			||||||
 | 
					    foreach ($chapters as $chapter) {
 | 
				
			||||||
 | 
					        foreach ($chapter['content'] as $chContent) {
 | 
				
			||||||
 | 
					            if ($chContent['file'] == basename($currentFile)) {
 | 
				
			||||||
 | 
					                $guideHeadline = "{$chContent['headline']} - {$chapter['headline']}";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php', isset($guideHeadline) ? ['guideHeadline' => $guideHeadline] : []); ?>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="row">
 | 
					<div class="row">
 | 
				
			||||||
    <div class="col-md-2">
 | 
					    <div class="col-md-2">
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@
 | 
				
			|||||||
use yii\bootstrap\Nav;
 | 
					use yii\bootstrap\Nav;
 | 
				
			||||||
use yii\bootstrap\NavBar;
 | 
					use yii\bootstrap\NavBar;
 | 
				
			||||||
use yii\helpers\Html;
 | 
					use yii\helpers\Html;
 | 
				
			||||||
 | 
					use yii\helpers\StringHelper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* @var $this yii\web\View */
 | 
					/* @var $this yii\web\View */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -29,7 +30,14 @@ $this->beginPage();
 | 
				
			|||||||
    <meta name="language" content="en" />
 | 
					    <meta name="language" content="en" />
 | 
				
			||||||
    <?= Html::csrfMetaTags() ?>
 | 
					    <?= Html::csrfMetaTags() ?>
 | 
				
			||||||
    <?php $this->head() ?>
 | 
					    <?php $this->head() ?>
 | 
				
			||||||
    <title><?= Html::encode($this->context->pageTitle) ?></title>
 | 
					    <title><?php if (isset($type)) {
 | 
				
			||||||
 | 
					            echo Html::encode(StringHelper::basename($type->name) . ", {$type->name} - {$this->context->pageTitle}");
 | 
				
			||||||
 | 
					        } elseif (isset($guideHeadline)) {
 | 
				
			||||||
 | 
					            echo Html::encode("$guideHeadline - {$this->context->pageTitle}");
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            echo Html::encode($this->context->pageTitle);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    ?></title>
 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
<body>
 | 
					<body>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -102,9 +102,7 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface
 | 
				
			|||||||
            Console::startProgress(0, $typeCount, 'Rendering files: ', false);
 | 
					            Console::startProgress(0, $typeCount, 'Rendering files: ', false);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        $done = 0;
 | 
					        $done = 0;
 | 
				
			||||||
        $oldTitle = $this->pageTitle;
 | 
					 | 
				
			||||||
        foreach ($types as $type) {
 | 
					        foreach ($types as $type) {
 | 
				
			||||||
            $this->pageTitle = StringHelper::basename($type->name) . ", {$type->name} - $oldTitle";
 | 
					 | 
				
			||||||
            $fileContent = $this->renderWithLayout($this->typeView, [
 | 
					            $fileContent = $this->renderWithLayout($this->typeView, [
 | 
				
			||||||
                'type' => $type,
 | 
					                'type' => $type,
 | 
				
			||||||
                'apiContext' => $context,
 | 
					                'apiContext' => $context,
 | 
				
			||||||
@ -116,7 +114,6 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface
 | 
				
			|||||||
                Console::updateProgress(++$done, $typeCount);
 | 
					                Console::updateProgress(++$done, $typeCount);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        $this->pageTitle = $oldTitle;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $indexFileContent = $this->renderWithLayout($this->indexView, [
 | 
					        $indexFileContent = $this->renderWithLayout($this->indexView, [
 | 
				
			||||||
            'apiContext' => $context,
 | 
					            'apiContext' => $context,
 | 
				
			||||||
 | 
				
			|||||||
@ -43,7 +43,7 @@ abstract class GuideRenderer extends BaseGuideRenderer
 | 
				
			|||||||
        parent::init();
 | 
					        parent::init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($this->pageTitle === null) {
 | 
					        if ($this->pageTitle === null) {
 | 
				
			||||||
            $this->pageTitle = 'Yii Framework 2.0 API Documentation'; // TODO guess page title
 | 
					            $this->pageTitle = 'The Definitive Guide to Yii 2.0';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user