public static function title($id) {
        $module = \jacmoe\mdpages\Module::getInstance();
        if(!is_null($module)) {
            $controller = \Yii::$app->controller;
            if(!is_null($controller)) {
                if($controller->id == 'page') {
                    $repo = $controller->getFlywheelRepo();
                    $page = $repo->query()->where('url', '==', $id)->execute();
                    $result = $page->first();

                    if($result != null) {
                        if(isset($result->title)) {
                            return $result->title;
                        }
                    }
                    return 'page not found';
                }
                throw new NotSupportedException("Can only be used when active controller is 'page'.");
            }
        }
        throw new NotSupportedException("Can't be called outside of jacmoe\mdpages module.");
    }
public static function title($id) {
        $module = \jacmoe\mdpages\Module::getInstance();
        if(!is_null($module)) {
            $controller = \Yii::$app->controller;
            if(!is_null($controller)) {
                if($controller->id == 'page') {
                    $repo = $controller->getFlywheelRepo();
                    $page = $repo->query()->where('url', '==', $id)->execute();
                    $result = $page->first();

                    if($result != null) {
                        if(isset($result->title)) {
                            return $result->title;
                        }
                    }
                    return 'page not found';
                }
                throw new NotSupportedException("Can only be used when active controller is 'page'.");
            }
        }
        throw new NotSupportedException("Can't be called outside of jacmoe\mdpages module.");
    }
public static function title ( $ id ) { $ module = \ jacmoe \ mdpages \ Module :: getInstance ( ) ; if ( ! is_null ( $ module ) ) { $ controller = \ Yii :: $ app -> controller ; if ( ! is_null ( $ controller ) ) { if ( $ controller -> id == 'page' ) { $ repo = $ controller -> getFlywheelRepo ( ) ; $ page = $ repo -> query ( ) -> where ( 'url' , '==' , $ id ) -> execute ( ) ; $ result = $ page -> first ( ) ; if ( $ result != null ) { if ( isset ( $ result -> title ) ) { return $ result -> title ; } } return 'page not found' ; } throw new NotSupportedException ( "Can only be used when active controller is 'page'." ) ; } } throw new NotSupportedException ( "Can't be called outside of jacmoe\mdpages module." ) ; }
Returns the title of a page
@param  string $id the id of the page to get a title for
@return string     page title
Returns the title of a page