Backend\Modules\Pages\Engine\Model::createHtml PHP Method

createHtml() public static method

Creates the html for the menu
public static createHtml ( string $type = 'page', integer $depth, integer $parentId = 1, string $html = '' ) : string
$type string The type of navigation.
$depth integer The maximum depth to show.
$parentId integer The Id to start from.
$html string Will hold the created HTML.
return string
    public static function createHtml($type = 'page', $depth = 0, $parentId = 1, $html = '')
    {
        $navigation = static::getCacheBuilder()->getNavigation(BL::getWorkingLanguage());
        // check if item exists
        if (isset($navigation[$type][$depth][$parentId])) {
            // start html
            $html .= '<ul>' . "\n";
            // loop elements
            foreach ($navigation[$type][$depth][$parentId] as $key => $aValue) {
                $html .= "\t<li>" . "\n";
                $html .= "\t\t" . '<a href="#">' . $aValue['navigation_title'] . '</a>' . "\n";
                // insert recursive here!
                if (isset($navigation[$type][$depth + 1][$key])) {
                    $html .= self::createHtml($type, $depth + 1, $parentId, '');
                }
                // add html
                $html .= '</li>' . "\n";
            }
            // end html
            $html .= '</ul>' . "\n";
        }
        // return
        return $html;
    }