yii\apidoc\renderers\BaseRenderer::generateGuideUrl PHP Method

generateGuideUrl() public method

Generate an url to a guide page
public generateGuideUrl ( string $file ) : string
$file string
return string
    public function generateGuideUrl($file)
    {
        //skip parsing external url
        if (strpos($file, 'https://') !== false || strpos($file, 'http://') !== false) {
            return $file;
        }
        $hash = '';
        if (($pos = strpos($file, '#')) !== false) {
            $hash = substr($file, $pos);
            $file = substr($file, 0, $pos);
        }
        return rtrim($this->guideUrl, '/') . '/' . $this->guidePrefix . basename($file, '.md') . '.html' . $hash;
    }

Usage Example

Beispiel #1
0
 /**
  * @inheritdoc
  */
 protected function parseLink($markdown)
 {
     list($result, $skip) = parent::parseLink($markdown);
     // add special syntax for linking to the guide
     $result = preg_replace_callback('/href="guide:([A-z0-9-.#]+)"/i', function ($match) {
         return 'href="' . static::$renderer->generateGuideUrl($match[1]) . '"';
     }, $result, 1);
     return [$result, $skip];
 }
All Usage Examples Of yii\apidoc\renderers\BaseRenderer::generateGuideUrl