Commit 36ed709e by Carsten Brandt

Merge pull request #2840 from schmunk42/feature/apidoc

Minor apidoc updates
parents 44d9d0da 0cd46260
...@@ -11,43 +11,44 @@ ...@@ -11,43 +11,44 @@
defined('YII_DEBUG') or define('YII_DEBUG', false); defined('YII_DEBUG') or define('YII_DEBUG', false);
$composerAutoload = [ $composerAutoload = [
__DIR__ . '/vendor/autoload.php', // standalone with "composer install" run __DIR__ . '/vendor/autoload.php', // standalone with "composer install" run
__DIR__ . '/../../autoload.php', // script is installed as a composer binary __DIR__ . '/../../autoload.php', // script is installed as a composer binary
__DIR__ . '/../../../../autoload.php', // script is run from yii2-dev/extensions
]; ];
$vendorPath = null; $vendorPath = null;
foreach ($composerAutoload as $autoload) { foreach ($composerAutoload as $autoload) {
if (file_exists($autoload)) { if (file_exists($autoload)) {
require($autoload); require($autoload);
$vendorPath = dirname($autoload); $vendorPath = dirname($autoload);
break; break;
} }
} }
$yiiDirs = [ $yiiDirs = [
__DIR__ . '/../../framework', // in yii2-dev repo __DIR__ . '/../../framework', // in yii2-dev repo
__DIR__ . '/vendor/yiisoft/yii2', // standalone with "composer install" run __DIR__ . '/vendor/yiisoft/yii2', // standalone with "composer install" run
__DIR__ . '/../../yiisoft/yii2', // script is installed as a composer binary __DIR__ . '/../../yiisoft/yii2', // script is installed as a composer binary
]; ];
foreach ($yiiDirs as $dir) { foreach ($yiiDirs as $dir) {
if (file_exists($dir . '/Yii.php')) { if (file_exists($dir . '/Yii.php')) {
require($dir . '/Yii.php'); require($dir . '/Yii.php');
break; break;
} }
} }
if (!class_exists('Yii')) { if (!class_exists('Yii')) {
echo PHP_EOL . "The Yii Framework 2.0 does not seem to be installed. Try running composer install." . PHP_EOL . PHP_EOL; echo PHP_EOL . "The Yii Framework 2.0 does not seem to be installed. Try running composer install." . PHP_EOL . PHP_EOL;
exit(1); exit(1);
} }
Yii::setAlias('@yii/apidoc', __DIR__); Yii::setAlias('@yii/apidoc', __DIR__);
$application = new yii\console\Application([ $application = new yii\console\Application([
'id' => 'yii2-apidoc', 'id' => 'yii2-apidoc',
'basePath' => __DIR__, 'basePath' => __DIR__,
'enableCoreCommands' => false, 'enableCoreCommands' => false,
'controllerNamespace' => 'yii\\apidoc\\commands', 'controllerNamespace' => 'yii\\apidoc\\commands',
]); ]);
if ($vendorPath !== null) { if ($vendorPath !== null) {
$application->setVendorPath($vendorPath); $application->setVendorPath($vendorPath);
} }
$exitCode = $application->run(); $exitCode = $application->run();
exit($exitCode); exit($exitCode);
...@@ -15,7 +15,7 @@ $renderer = $this->context; ...@@ -15,7 +15,7 @@ $renderer = $this->context;
$this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?> $this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-md-3">
<?php <?php
$types = $renderer->getNavTypes(isset($type) ? $type : null, $types); $types = $renderer->getNavTypes(isset($type) ? $type : null, $types);
ksort($types); ksort($types);
......
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