Skip to content
Snippets Groups Projects
page_helper.php 1.23 KiB
Newer Older
  • Learn to ignore specific revisions
  • /**
     * @copyright  2020 Podlibre
     * @license    https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
     * @link       https://castopod.org/
     */
    
    use App\Models\PageModel;
    
    
    if (! function_exists('render_page_links')) {
    
        /**
         * Returns instance pages as links inside nav tag
         *
         * @return string html pages navigation
         */
        function render_page_links(string $class = null): string
        {
            $pages = (new PageModel())->findAll();
            $links = anchor(route_to('home'), lang('Common.home'), [
    
                'class' => 'px-2 py-1 underline hover:no-underline focus:ring-accent',
    
            $links .= anchor(route_to('credits'), lang('Person.credits'), [
    
                'class' => 'px-2 py-1 underline hover:no-underline focus:ring-accent',
    
            $links .= anchor(route_to('map'), lang('Page.map.title'), [
    
                'class' => 'px-2 py-1 underline hover:no-underline focus:ring-accent',
    
            foreach ($pages as $page) {
                $links .= anchor($page->link, $page->title, [
    
                    'class' => 'px-2  py-1 underline hover:no-underline focus:ring-accent',
    
            return '<nav class="' . $class . '">' . $links . '</nav>';
        }