(non-PHPdoc).

@see \Zend\View\Helper\Navigation\Menu::htmlify()
@param AbstractPage $page
@param bool $escapeLabel
@param bool $addClassToListItem
@return string
502989
public function htmlify(AbstractPage $page, $escapeLabel = true, $addClassToListItem = false)
    {
        if ($page instanceof Divider) {
            return '<li class="divider"></li>';
        }

        $label = $page->getLabel();
        $title = $page->getTitle();

        if (null !== ($translator = $this->getTranslator())) {
            $textDomain = $this->getTranslatorTextDomain();
            if (is_string($label) && ! empty($label)) {
                $label = $translator->translate($label, $textDomain);
            }
            if (is_string($title) && ! empty($title)) {
                $title = $translator->translate($title, $textDomain);
            }
        }

        $element = 'a';
        $extended = '';
        $attribs = [
            'id' => $page->getId(),
            'title' => $title,
            'href' => '#',
        ];

        $class = [];
        if ($addClassToListItem === false) {
            $class[] = $page->getClass();
        }
        if ($page->isDropdown) {
            $attribs['data-toggle'] = 'dropdown';
            $class[] = 'dropdown-toggle';
            $extended = ' <b class="caret"></b>';
        }
        if (count($class) > 0) {
            $attribs['class'] = implode(' ', $class);
        }

        $href = $page->getHref();
        if ($href) {
            $attribs['href'] = $href;
            $attribs['target'] = $page->getTarget();
        }

        $html = '<'.$element.$this->htmlAttribs($attribs).'>';
        if ($escapeLabel === true) {
            $escaper = $this->view->plugin('escapeHtml');
            $html .= $escaper($label);
        } else {
            $html .= $label;
        }

        $html .= $extended;
        $html .= '</'.$element.'>';

        return $html;
    }
1077945
public static function add($label, $urlCode = null, $addedArgs = array())
  {
    self::$items[] = new BreadcrumbItem($label, $urlCode, $addedArgs);
  }
767278
public HTMLForm addClass(String clazz) {
        String currentClass = this.getProperty("class");
        if (currentClass != null) {
            currentClass += " " + clazz;
        } else {
            currentClass = clazz;
        }
        this.setProperty("class", currentClass);

        return this;
    }
1290731
function headerLabel( $page, $level )
    {
        $headerLabel = '';
        foreach ( array_keys( $this->TOC ) as $key )
        {
            $header = $this->TOC[$key];
            if ( $header['pageNumber'] > $page )
                return $headerLabel;

            if ( $header['level'] == $level )
            {
                $headerLabel = $header['label'];
            }
            else if ( $header['level'] < $level )
            {
                $headerLabel = '';
            }
        }

        return $headerLabel;
    }
941326
public function get_listing($encodedpath = '', $page = '') {
        global $CFG, $USER, $OUTPUT;
        $ret = array();
        $ret['dynload'] = true;
        $ret['nosearch'] = false;
        $ret['nologin'] = true;
        $ret['list'] = array();

        $itemid   = null;
        $filename = null;
        $filearea = null;
        $filepath = null;
        $component = null;

        if (!empty($encodedpath)) {
            $params = json_decode(base64_decode($encodedpath), true);
            if (is_array($params) && isset($params['contextid'])) {
                $component = is_null($params['component']) ? NULL : clean_param($params['component'], PARAM_COMPONENT);
                $filearea  = is_null($params['filearea']) ? NULL : clean_param($params['filearea'], PARAM_AREA);
                $itemid    = is_null($params['itemid']) ? NULL : clean_param($params['itemid'], PARAM_INT);
                $filepath  = is_null($params['filepath']) ? NULL : clean_param($params['filepath'], PARAM_PATH);
                $filename  = is_null($params['filename']) ? NULL : clean_param($params['filename'], PARAM_FILE);
                $context = context::instance_by_id(clean_param($params['contextid'], PARAM_INT));
            }
        }
        if (empty($context) && !empty($this->context)) {
            $context = $this->context->get_course_context(false);
        }
        if (empty($context)) {
            $context = context_system::instance();
        }

        // prepare list of allowed extensions: $extensions is either string '*'
        // or array of lowercase extensions, i.e. array('.gif','.jpg')
        $extensions = optional_param_array('accepted_types', '', PARAM_RAW);
        if (empty($extensions) || $extensions === '*' || (is_array($extensions) && in_array('*', $extensions))) {
            $extensions = '*';
        } else {
            if (!is_array($extensions)) {
                $extensions = array($extensions);
            }
            $extensions = array_map('core_text::strtolower', $extensions);
        }

        // build file tree
        $browser = get_file_browser();
        if (!($fileinfo = $browser->get_file_info($context, $component, $filearea, $itemid, $filepath, $filename))) {
            // if file doesn't exist, build path nodes root of current context
            $fileinfo = $browser->get_file_info($context, null, null, null, null, null);
        }
        $ret['list'] = $this->get_non_empty_children($fileinfo, $extensions);

        // build path navigation
        $path = array();
        for ($level = $fileinfo; $level; $level = $level->get_parent()) {
            array_unshift($path, $level);
        }
        array_unshift($path, null);
        $ret['path'] = array();
        for ($i=1; $i<count($path); $i++) {
            if ($path[$i] == $fileinfo || !$this->can_skip($path[$i], $extensions, $path[$i-1])) {
                $ret['path'][] = $this->get_node_path($path[$i]);
            }
        }
        return $ret;
    }
701836
public function generateLinksCenter(string $page = null, string $ignoredKeys = null, $linksClassName = null): string
    {
        // only one page?
        $totalPages = $this->totalPages;
        if ($totalPages == 1) {
            return $this->template(['<a class="current" href="#">1</a>'], $linksClassName, true);
        }

        $links = (array) $this->linksCenter;
        if ($links != null) {
            return $this->template($links, $linksClassName, true);
        }

        $linksTemplate = $this->linksTemplate;

        $s = $this->startKey;
        $query = $this->prepareQuery($ignoredKeys);
        $start = max(1, ($this->start / $this->stop) + 1);

        // add first & prev links
        $prev = $start - 1;
        if ($prev >= 1) {
            $links[] = sprintf('<a class="first" rel="first" href="%s%s=1">%s</a>', $query, $s,
                $linksTemplate['first']);
            $links[] = sprintf('<a class="prev" rel="prev" href="%s%s=%s">%s</a>', $query, $s, $prev,
                $linksTemplate['prev']);
        }

        $links[] = sprintf('<a class="current" href="#">%s %s</a>',
            $page ?? $linksTemplate['page'], $start);

        // add next & last link
        $next = $start + 1;
        if ($start < $totalPages) {
            $links[] = sprintf('<a class="next" rel="next" href="%s%s=%s">%s</a>', $query, $s, $next,
                $linksTemplate['next']);
            $links[] = sprintf('<a class="last" rel="last" href="%s%s=%s">%s</a>', $query, $s, $totalPages,
                $linksTemplate['last']);
        }

        // store
        $this->linksCenter = $links;

        return $this->template($links, $linksClassName, true);
    }
804482
private function getElementValue(AbstractClassContent $content, Page $page)
    {
        $draft = $this->releaseDraft($content);

        if ($content instanceof File) {
            $value = $content->path;
        } elseif ($content instanceof Keyword) {
            $value = $this->getKeyword($content);
        } else {
            $value = trim(str_replace(array("\n", "\r"), '', strip_tags(''.$content)));
        }

        $this->setMainNode($content, $page);
        $this->restoreDraft($content, $draft);

        return $value;
    }
820222
public function addJSCSS(array $parameters, \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer)
    {
        if (!empty($GLOBALS['SOBE']) && (get_class($GLOBALS['SOBE']) === RecordListController::class || is_subclass_of(
            $GLOBALS['SOBE'],
                    RecordListController::class
        ))) {
            $pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsOnReady');
            return;
        }
        if (!empty($GLOBALS['SOBE']) && (get_class($GLOBALS['SOBE']) === PageLayoutController::class || is_subclass_of(
            $GLOBALS['SOBE'],
                    PageLayoutController::class
        ))) {
            $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
            $pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsOnReady');
            $pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsDragDrop');
            $pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsDragInWizard');

            /** @var Clipboard $clipObj */
            $clipObj = GeneralUtility::makeInstance(Clipboard::class); // Start clipboard
            $clipObj->initializeClipboard();
            $clipObj->lockToNormal();
            $clipBoard = $clipObj->clipData['normal'];
            if (!$pageRenderer->getCharSet()) {
                $pageRenderer->setCharSet('utf-8');
            }

            // pull locallang_db.xml to JS side - only the tx_gridelements_js-prefixed keys
            $pageRenderer->addInlineLanguageLabelFile(
                'EXT:gridelements/Resources/Private/Language/locallang_db.xml',
                'tx_gridelements_js'
            );

            $pAddExtOnReadyCode = '
                TYPO3.l10n = {
                    localize: function(langKey){
                        return TYPO3.lang[langKey];
                    }
                }
            ';

            $id = (int)GeneralUtility::_GP('id');
            $layout = GeneralUtility::callUserFunction(
                BackendLayoutView::class . '->getSelectedBackendLayout',
                $id,
                $this
            );
            if (is_array($layout) && !empty($layout['__config']['backend_layout.']['rows.'])) {
                /** @var LayoutSetup $layoutSetup */
                $layoutSetup = GeneralUtility::makeInstance(LayoutSetup::class)->init(0);
                $layout = ['config' => $layout['__config']['backend_layout.']];
                $columns = $layoutSetup->checkAvailableColumns($layout, true);
                if ($columns['allowed'] || $columns['disallowed'] || $columns['maxitems']) {
                    $layout['columns'] = $columns;
                    unset($layout['columns']['allowed']);
                    $layout['allowed'] = $columns['allowed'] ?: [];
                    $layout['disallowed'] = $columns['disallowed'] ?: [];
                    $layout['maxitems'] = $columns['maxitems'] ?: [];
                }
            }

            // add Ext.onReady() code from file
            $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
            $pAddExtOnReadyCode .= '
            top.pageColumnsAllowed = ' . json_encode($layout['allowed']) . ';
            top.pageColumnsDisallowed = ' . json_encode($layout['disallowed']) . ';
            top.pageColumnsMaxitems = ' . json_encode($layout['maxitems']) . ';
            top.pasteReferenceAllowed = ' . ($this->getBackendUser()->checkAuthMode(
                'tt_content',
                'CType',
                'shortcut',
                    $GLOBALS['TYPO3_CONF_VARS']['BE']['explicitADmode']
            ) ? 'true' : 'false') . ';
            top.skipDraggableDetails = ' . ($this->getBackendUser()->uc['dragAndDropHideNewElementWizardInfoOverlay'] ? 'true' : 'false') . ";
            top.backPath = '" . $GLOBALS['BACK_PATH'] . "';
            top.browserUrl = '" . htmlspecialchars($uriBuilder->buildUriFromRoute('wizard_element_browser')) . "';";

            if (!empty($clipBoard) && !empty($clipBoard['el'])) {
                $clipBoardElement = GeneralUtility::trimExplode('|', key($clipBoard['el']));
                if ($clipBoardElement[0] === 'tt_content') {
                    $clipBoardElementData = BackendUtility::getRecord('tt_content', (int)$clipBoardElement[1]);
                    $pAddExtOnReadyCode .= "
            top.clipBoardElementCType = '" . $clipBoardElementData['CType'] . "';
            top.clipBoardElementTxGridelementsBackendLayout = '" . (($clipBoardElementData['CType'] == 'gridelements_pi1') ? $clipBoardElementData['tx_gridelements_backend_layout'] : '') . "';
            top.clipBoardElementListType = '" . $clipBoardElementData['list_type'] . "';";
                } else {
                    $pAddExtOnReadyCode .= "
            top.clipBoardElementCType = '';
            top.clipBoardElementTxGridelementsBackendLayout = '';
            top.clipBoardElementListType = '';";
                }
            }

            $pAddExtOnReadyCode .= '
                    top.copyFromAnotherPageLinkTemplate = ' . json_encode('<a class="t3js-paste-new btn btn-default" title="' . $this->getLanguageService()->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_js.copyfrompage') . '">' . $iconFactory->getIcon(
                'actions-insert-reference',
                        Icon::SIZE_SMALL
            )->render() . '</a>') . ';';

            $pageRenderer->addJsInlineCode('gridelementsExtOnReady', $pAddExtOnReadyCode);
        }
    }
655036
public function htmlify(AbstractPage $page, $hasParent = false)
    {
        $html = '<li';
        if (! $hasParent) {
            $html .= ' class="active"';
        }
        $html .= '>';

        $label = $page->getLabel();
        if (null !== ($translator = $this->getTranslator())) {
            $label = $translator->translate($label, $this->getTranslatorTextDomain());
        }
        $escaper = $this->view->plugin('escapeHtml');
        $label = $escaper($label);

        if ($page->getHref() && ($hasParent || (! $hasParent && $this->getLinkLast())) &&
            (! ($page instanceof Uri) || $page->getUri() != '#')) {
            $anchorAttribs = $this->htmlAttribs(['href' => $page->getHref()]);
            $html .= '<a'.$anchorAttribs.'>'.$label.'</a>';
        } else {
            $html .= $label;
        }

        $html .= '</li>';

        return $html;
    }
799543
@Nullable
  @OverrideOnDemand
  public IHCNode renderMenuItemPage (@Nonnull final IWebPageExecutionContext aWPEC,
                                     @Nonnull final IMenuItemPage aMenuItemPage)
  {
    if (!aMenuItemPage.matchesDisplayFilter ())
      return null;

    final Locale aDisplayLocale = aWPEC.getDisplayLocale ();
    final HCA ret = new HCA (aWPEC.getLinkToMenuItem (aMenuItemPage.getID ()));
    // Set window target (if defined)
    if (aMenuItemPage.hasTarget ())
      ret.setTarget (new HC_Target (aMenuItemPage.getTarget ()));
    ret.addChild (aMenuItemPage.getDisplayText (aDisplayLocale));
    return ret;
  }
832662
public static function processImageExcerpt(array $excerpt, PageInterface $page)
    {
        $url = htmlspecialchars_decode(urldecode($excerpt['element']['attributes']['src']));
        $url_parts = static::parseUrl($url);

        $media = null;
        $filename = null;

        if (!empty($url_parts['stream'])) {
            $filename = $url_parts['scheme'] . '://' . ($url_parts['path'] ?? '');

            $media = $page->getMedia();

        } else {
            $grav = Grav::instance();

            // File is also local if scheme is http(s) and host matches.
            $local_file = isset($url_parts['path'])
                && (empty($url_parts['scheme']) || in_array($url_parts['scheme'], ['http', 'https'], true))
                && (empty($url_parts['host']) || $url_parts['host'] === $grav['uri']->host());

            if ($local_file) {
                $filename = basename($url_parts['path']);
                $folder = dirname($url_parts['path']);

                // Get the local path to page media if possible.
                if ($folder === $page->url(false, false, false)) {
                    // Get the media objects for this page.
                    $media = $page->getMedia();
                } else {
                    // see if this is an external page to this one
                    $base_url = rtrim($grav['base_url_relative'] . $grav['pages']->base(), '/');
                    $page_route = '/' . ltrim(str_replace($base_url, '', $folder), '/');

                    /** @var PageInterface $ext_page */
                    $ext_page = $grav['pages']->dispatch($page_route, true);
                    if ($ext_page) {
                        $media = $ext_page->getMedia();
                    } else {
                        $grav->fireEvent('onMediaLocate', new Event(['route' => $page_route, 'media' => &$media]));
                    }
                }
            }
        }

        // If there is a media file that matches the path referenced..
        if ($media && $filename && isset($media[$filename])) {
            // Get the medium object.
            /** @var Medium $medium */
            $medium = $media[$filename];

            // Process operations
            $medium = static::processMediaActions($medium, $url_parts);
            $element_excerpt = $excerpt['element']['attributes'];

            $alt = $element_excerpt['alt'] ?? '';
            $title = $element_excerpt['title'] ?? '';
            $class = $element_excerpt['class'] ?? '';
            $id = $element_excerpt['id'] ?? '';

            $excerpt['element'] = $medium->parsedownElement($title, $alt, $class, $id, true);

        } else {
            // Not a current page media file, see if it needs converting to relative.
            $excerpt['element']['attributes']['src'] = Uri::buildUrl($url_parts);
        }

        return $excerpt;
    }
153255
public function __toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayErrors = true, $intCount = 0)
    {
        $strName = ($intCount == 0) ? $this->__name : $this->__name . "_" . $intCount;
        $strId = ($intCount == 0) ? $this->__id : $this->__id . "_" . $intCount;

        $blnError = ($submitted && ! $this->__validator->validate($intCount) && $blnDisplayErrors) ? true : false;

        if (! $blnSimpleLayout) {
            // *** We asume that all dynamic fields greater than 0 are never required.
            if ($this->__validator->getRequired() && $intCount == 0) {
                $this->setMeta("class", "vf__required");
            } else {
                $this->setMeta("class", "vf__optional");
            }

            // *** Set custom meta.
            if ($blnError) {
                $this->setMeta("class", "vf__error");
            }

            if (! $blnLabel) {
                $this->setMeta("class", "vf__nolabel");
            }

                // Call this right before __getMetaString();
            $this->setConditionalMeta();

            $strOutput = "<div{$this->__getMetaString()}>\n";

            if ($blnError) {
                $strOutput .= "<p class=\"vf__error\">{$this->__validator->getError($intCount)}</p>";
            }

            if ($blnLabel) {
                $strLabel = (! empty($this->__requiredstyle) && $this->__validator->getRequired()) ? sprintf($this->__requiredstyle, $this->__label) : $this->__label;
                if (! empty($this->__label)) {
                    $strOutput .= "<label for=\"{$strId}\"{$this->__getLabelMetaString()}>{$strLabel}</label>\n";
                }
            }
        } else {
            if ($blnError) {
                $this->setMeta("class", "vf__error");
            }

            $this->setMeta("class", "vf__multifielditem");

            // Call this right before __getMetaString();
            $this->setConditionalMeta();

            $strOutput = "<div{$this->__getMetaString()}\">\n";
        }

        // *** Fixing an unusual uploading bug.
        $intMaxFileSize = $this->convertToBytes(ini_get("upload_max_filesize"));
        $strOutput .= "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"{$intMaxFileSize}\" />";

        $arrValues = [];
        $strValue = $this->__getValue($submitted, $intCount);
        if (!is_array($strValue)) {
            $strValue = htmlspecialchars($strValue, ENT_QUOTES);
            if (!empty($strValue)) {
                $arrValues = [$strValue];
            }
        } else {
            foreach ($strValue as $value) {
                $value = htmlspecialchars($value, ENT_QUOTES);
                $arrValues[] = $value;
            }
        }
        
        //*** Render the file input. We don't set a value for it.
        $strOutput .= "<input type=\"file\" name=\"{$strName}[]\" id=\"{$strId}\"{$this->__getFieldMetaString()} />\n";
        
        //*** Render sanitized values as hidden inputs.
        $intCount = 1;
        foreach ($arrValues as $strValue) {
            $strOutput .= "<input type=\"hidden\" name=\"{$strName}[]\" id=\"{$strId}-{$intCount}\" value=\"{$strValue}\" />\n";
        
            $intCount++;
        }
        
        if (! empty($this->__tip)) {
            $strOutput .= "<small class=\"vf__tip\"{$this->__getTipMetaString()}>{$this->__tip}</small>\n";
        }

        $strOutput .= "</div>\n";

        return $strOutput;
    }
860513
public function htmlPagination($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){
		return $this->addHtmlComponent(new HtmlPagination($identifier,$from,$to,$active,$countVisible));
	}
939612
public function addItem($label, $url = '', $translateLabel = true)
    {
        $b = new BreadcrumbItem($label, $url, $translateLabel);
        $this->items[] = $b;

        return $this;
    }
247655
protected function createNavbarMenuClass(AbstractPage $page, $ulClass, $depth)
    {
        if ($depth === 0 && $ulClass) {
            return ' class="' . $this->escapeHtmlAttribute($ulClass) . '"';
        } elseif ($page->getParent() && $depth <= self::MAX_RENDER_DEPTH) {
            return ' class="dropdown-menu"';
        }

        return '';
    }
61748
public function addLabel($label, $before=false, $icon=NULL) {
		$this->tagName="div";$prefix="";
		if($before)
			$prefix="left ";
		$this->addToProperty("class", $prefix."labeled");
		$isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon);
		$this->content=new HtmlButton("button-" . $this->identifier, $this->content);
		if($isIcon){
			$this->content->addClass("icon");
		}
		$this->content->setTagName("div");
		$label=new HtmlLabel("label-" . $this->identifier, $label, $icon,"a");
		$label->setBasic();
		$this->addContent($label, $before);
		return $label;
	}
1106829
protected String renderErrorPageToHTML(final WComponent errorPage) {

		// Check if using the default error page
		boolean defaultErrorPage = errorPage instanceof FatalErrorPage;

		String html = null;

		// If not default implementation of error page, Transform error page to HTML
		if (!defaultErrorPage) {
			// Set UIC and Environment (Needed for Theme Paths)
			UIContext uic = new UIContextImpl();
			uic.setEnvironment(createEnvironment());
			UIContextHolder.pushContext(uic);
			try {
				html = WebUtilities.renderWithTransformToHTML(errorPage);
			} catch (Exception e) {
				LOG.warn("Could not transform error page.", e);
			} finally {
				UIContextHolder.popContext();
			}
		}

		// Not transformed. So just render.
		if (html == null) {
			UIContextHolder.pushContext(new UIContextImpl());
			try {
				html = WebUtilities.render(errorPage);
			} catch (Exception e) {
				LOG.warn("Could not render error page.", e);
				html = "System error occurred but could not render error page.";
			} finally {
				UIContextHolder.popContext();
			}
		}

		return html;
	}