{layout '@layout.latte'}
{var $active = 'constant'}

{block title}{if $constant->deprecated}Deprecated {/if}Constant {$constant->name}{/block}

{block content}
<div id="content" class="constant">
	<h1 n:class="$constant->deprecated ? deprecated">Constant {$constant->shortName}</h1>

	{if $constant->valid}

	<div class="description" n:if="$template->longDescription($constant)">
	{$constant|longDescription|noescape}
	</div>

	<div class="alert alert-info">
		{if $constant->inNamespace()}<b>Namespace:</b> {$constant->namespaceName|namespaceLinks|noescape}<br>{/if}
		{if $constant->inPackage()}<b>Package:</b> {$constant->packageName|packageLinks|noescape}<br>{/if}
		{foreach $template->annotationSort($template->annotationFilter($constant->annotations, array('var'))) as $annotation => $values}
			{foreach $values as $value}
				<b>{$annotation|annotationBeautify}{if $value}:{/if}</b>
				{$value|annotation:$annotation:$constant|noescape}<br>
			{/foreach}
		{/foreach}
		<b>Located at</b>
		<a n:tag-if="$config->sourceCode" href="{$constant|sourceUrl}" title="Go to source code">
			{$constant->fileName|relativePath}
		</a><br>
	</div>

	{var $annotations = $constant->annotations}

	<div class="panel panel-default">
        <div class="panel-heading"><h2>Value summary</h2></div>
		<table class="summary table table-bordered table-striped" id="vars">
		<tr>
			<td class="name"><code>{$constant->typeHint|typeLinks:$constant|noescape}</code></td>
			<td class="value">{block|strip}
				{var $element = $template->resolveElement($constant->valueDefinition, $constant)}
				{if $element}<a href="{$element|constantUrl}">{$constant->valueDefinition}</a>{else}<code>{$constant->valueDefinition|highlightValue:$constant|noescape}</code>{/if}
			{/block}</td>
		</tr>
		</table>
	</div>

	{else}
		<div class="alert alert-error">
			<p>
				Documentation of this constant could not be generated.
			</p>
			<p>
				Constant was originally declared in {$constant->fileName|relativePath} and is invalid because of:
			</p>
			<ul>
				<li n:foreach="$constant->reasons as $reason">Constant was redeclared in {$reason->getSender()->getFileName()|relativePath}.</li>
			</ul>
		</div>
	{/if}
</div>
{/block}
