Kdyby\Translation\Diagnostics\Panel::getPanel PHP Method

getPanel() public method

Renders HTML code for custom panel.
public getPanel ( ) : string
return string
    public function getPanel()
    {
        $h = 'htmlSpecialChars';
        $panel = [];
        if (!empty($this->untranslated)) {
            $panel[] = $this->renderUntranslated();
        }
        if (!empty($this->onRequestLocaleSnapshot)) {
            if (!empty($panel)) {
                $panel[] = '<br><br>';
            }
            $panel[] = '<h2>Locale resolution</h2>';
            $panel[] = '<p>Order of locale resolvers and final locale for each request</p>';
            foreach ($this->onRequestLocaleSnapshot as $i => $snapshot) {
                $s = $i > 0 ? '<br>' : '';
                /** @var Request[] $snapshot */
                $params = $snapshot['request']->getParameters();
                $s .= '<tr><th width="10px">&nbsp;</th>' . '<th>' . $h($snapshot['request']->getPresenterName() . (isset($params['action']) ? ':' . $params['action'] : '')) . '</th>' . '<th>' . $h($snapshot['locale']) . '</th></tr>';
                $l = 1;
                foreach ($snapshot['resolvers'] as $name => $resolvedLocale) {
                    $s .= '<tr><td>' . $l++ . '.</td><td>' . $h($name) . '</td><td>' . $h($resolvedLocale) . '</td></tr>';
                }
                $panel[] = '<table style="width:100%">' . $s . '</table>';
            }
        }
        if (!empty($this->resources)) {
            if (!empty($panel)) {
                $panel[] = '<br><br>';
            }
            $panel[] = '<h2>Loaded resources</h2>';
            $panel[] = $this->renderResources($this->resources);
        }
        if (!empty($this->ignoredResources)) {
            if (!empty($panel)) {
                $panel[] = '<br><br>';
            }
            $panel[] = '<h2>Ignored resources</h2>';
            $panel[] = '<p>Whitelist config: ' . implode(', ', array_map($h, $this->localeWhitelist)) . '</p>';
            $panel[] = $this->renderResources($this->ignoredResources);
        }
        return empty($panel) ? '' : '<h1>Missing translations: ' . count(array_unique($this->untranslated, SORT_REGULAR)) . ', Resources: ' . count(Nette\Utils\Arrays::flatten($this->resources)) . '</h1>' . '<div class="nette-inner tracy-inner kdyby-TranslationPanel" style="min-width:500px">' . implode($panel) . '</div>' . '<style>
				#nette-debug .kdyby-TranslationPanel h2,
				#tracy-debug .kdyby-TranslationPanel h2 {font-size: 23px;}
			</style>';
    }