Skip to content

Commit

Permalink
.phpdoc/template/trait.html.twig: Add missing template
Browse files Browse the repository at this point in the history
  • Loading branch information
adriendupuis committed Dec 19, 2024
1 parent adf8181 commit cb1243e
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% set breadcrumbs = usesNamespaces ? breadcrumbs(node) : packages(node) %}
{% set fqcn = breadcrumbs|map(breadcrumb => breadcrumb.name)|join('\\') ~ '\\' ~ node.name %}

{% embed 'components/content-header.html.twig' with {
anchor: node.name,
anchor_link: '#' ~ node.name,
fqcn,
add_edition: true,
} %}
{% block subheader %}
<div class="content-header__subheader">Trait</div>

{% if node.usedTraits is not empty %}
<div class="content-header__subheader">
Uses
{% for trait in node.usedTraits %}
{{ trait|route('class:short') }}{% if not loop.last %}, {% endif %}
{% endfor %}
</div>
{% endif %}
{% endblock %}

{% endembed %}
89 changes: 89 additions & 0 deletions tools/php_api_ref/.phpdoc/template/trait.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{% extends 'base.html.twig' %}

{% block title %}{{ node.name }} | {{ parent() }}{% endblock %}
{% block meta %}
<meta name="description" content="{{ node.summary|escape }}" />
{{ parent() }}
{% endblock %}

{% block content %}
{% include 'components/breadcrumbs.html.twig' %}
{% include 'components/trait-title.html.twig' with { symfony_version: symfony_version } %}
{% include('components/element-header.html.twig') %}
{% include 'components/constants.html.twig' %}
{% include 'components/properties.html.twig' %}
{% include 'components/methods.html.twig' %}
{% endblock %}

{% block on_this_page %}
{% set constants = constants(node) %}
{% set properties = properties(node) %}
{% set methods = methods(node) %}

{% if constants is not empty or properties is not empty or methods is not empty %}
<label class="md-nav__title" for="__toc" title="{{ node.name }}">
{{ node.name }}
</label>
{% endif %}

<ul class="md-nav__list">
{% if constants is not empty %}
<li class="md-nav__item level-1 with-children">
<a href="{{ node|route("url")|raw }}#constants" title="Constants" class="md-nav__link">
Constants
</a>
<nav class="md-nav">
<ul class="md-nav__list">
{% for constant in constants|sortByVisibility %}
<li class="md-nav__item level-2">
<a href="{{ link(constant) }}" title="{{ constant.name }}" class="md-nav__link">
{{ constant.name }}
</a>
</li>
{% endfor %}
</ul>
</nav>
</li>
{% endif %}
{% if properties is not empty %}
<li class="md-nav__item level-1 with-children">
<a href="{{ node|route("url")|raw }}#properties" title="Properties" class="md-nav__link">
Properties
</a>
<nav class="md-nav">
<ul class="md-nav__list">
{% set treated_properties = [] %}
{% for property in properties|sortByVisibility %}
{% if property.__toString() not in treated_properties %}
<li class="md-nav__item level-2">
<a href="{{ link(property) }}" title="{{ property.name }}" class="md-nav__link">
{{ property.name }}
</a>
</li>
{% set treated_properties = treated_properties|merge([property.__toString()]) %}
{% endif %}
{% endfor %}
</ul>
</nav>
</li>
{% endif %}
{% if methods is not empty %}
<li class="md-nav__item level-1 with-children">
<a href="{{ node|route("url")|raw }}#methods" title="Methods" class="md-nav__link">
Methods
</a>
<nav class="md-nav">
<ul class="md-nav__list">
{% for method in methods|sortByVisibility %}
<li class="md-nav__item level-2">
<a href="{{ link(method) }}" title="{{ method.name }}" class="md-nav__link">
{{ method.name }}()
</a>
</li>
{% endfor %}
</ul>
</nav>
</li>
{% endif %}
</ul>
{% endblock %}

0 comments on commit cb1243e

Please sign in to comment.