Skip to content

Commit f6f0894

Browse files
committed
Get #2584 enhancements
1 parent 177c2d8 commit f6f0894

15 files changed

+192
-30
lines changed

tools/php_api_ref/.phpdoc/template/base.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
{{ parent() }}
77

88
<script>
9+
window.symfonyVersion = '{{ symfony_version }}';
910
window.addEventListener('keyup', (event) => {
1011
if (event.key === '/') {
1112
event.stopImmediatePropagation();

tools/php_api_ref/.phpdoc/template/class.html.twig

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
{% block content %}
1010
{% include 'components/breadcrumbs.html.twig' %}
11-
{% include 'components/class-title.html.twig' with { symfony_version: symfony_version } %}
12-
{% include('components/element-header.html.twig') %}
11+
{% include 'components/class-title.html.twig' %}
12+
{% include 'components/element-header.html.twig' %}
1313
{% include 'components/constants.html.twig' %}
1414
{% include 'components/properties.html.twig' %}
1515
{% include 'components/methods.html.twig' %}
@@ -52,12 +52,16 @@
5252
</a>
5353
<nav class="md-nav">
5454
<ul class="md-nav__list">
55+
{% set treated_properties = [] %}
5556
{% for property in properties|sortByVisibility %}
56-
<li class="md-nav__item level-2">
57-
<a href="{{ link(property) }}" title="{{ property.name }}" class="md-nav__link">
58-
{{ property.name }}
59-
</a>
60-
</li>
57+
{% if property.__toString() not in treated_properties %}
58+
<li class="md-nav__item level-2">
59+
<a href="{{ link(property) }}" title="{{ property.name }}" class="md-nav__link">
60+
{{ property.name }}
61+
</a>
62+
</li>
63+
{% set treated_properties = treated_properties|merge([property.__toString()]) %}
64+
{% endif %}
6165
{% endfor %}
6266
</ul>
6367
</nav>

tools/php_api_ref/.phpdoc/template/components/class-title.html.twig

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
add_edition: true,
99
} %}
1010
{% block subheader %}
11+
{% if node.isAbstract %}
12+
<div class="content-header__subheader">Abstract</div>
13+
{% endif %}
14+
1115
{% if node.parent %}
1216
<div class="content-header__subheader">
13-
{% if node.parent.__toString starts with '\\Symfony\\' %}
14-
Extends
15-
<a href="{{ 'https://github.com/symfony/symfony/blob/' ~ symfony_version ~ '/src' ~ node.parent|replace({'\\': '/'}) ~ '.php' }}" class="external">
16-
<abbr title="{{ node.parent }}">{{ node.parent.name }}</abbr>
17-
</a>
18-
{% else %}
19-
Extends {{ node.parent|route('class:short') }}
20-
{% endif %}
17+
Extends {{ node.parent|route('class:short') }}
2118
</div>
2219
{% endif %}
2320

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{% extends "package-edition-map.twig" %}
22

33
{% block content %}
4-
{% set edition_list = [
4+
{# List of displayable editions sorted in inclusion order, each edition includes the previous ones #}
5+
{% set edition_pill_list = [
56
'experience',
67
'commerce',
78
] %}
@@ -17,15 +18,21 @@
1718
{% endfor %}
1819
{% endif %}
1920

20-
{% if package_edition_map[package] is defined and package_edition_map[package] in edition_list %}
21-
{% set is_supporting = false %}
22-
{% for edition in edition_list %}
23-
{% if edition == package_edition_map[package] %}
24-
{% set is_supporting = true %}
25-
{% endif %}
26-
{% if is_supporting %}
27-
<div class="pill {{ edition }}-pill"></div>
28-
{% endif %}
29-
{% endfor %}
21+
{% if package_edition_map[package] is defined %}
22+
{% if package_edition_map[package] in edition_pill_list %}
23+
{% set is_supporting = false %}
24+
{# display edition pills since minimal edition supporting the package #}
25+
{% for edition in edition_pill_list %}
26+
{% if edition == package_edition_map[package] %}
27+
{% set is_supporting = true %}
28+
{% endif %}
29+
{% if is_supporting %}
30+
<div class="pill {{ edition }}-pill"></div>
31+
{% endif %}
32+
{% endfor %}
33+
{% endif %}
34+
{% else %}
35+
{# if package is not in an edition #}
36+
<div class="pill optional-pill" title="Included in the optional package {{ package }}"></div>
3037
{% endif %}
3138
{% endblock %}

tools/php_api_ref/.phpdoc/template/components/interface-title.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
add_edition: true,
99
} %}
1010
{% block subheader %}
11+
<div class="content-header__subheader">Interface</div>
12+
1113
{% if node.parent is not empty %}
1214
<div class="content-header__subheader">
1315
Extends
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{% set properties = properties(node)|sortByVisibility %}
2+
{% set explorable_properties = properties(node)|sortByVisibility %}
3+
{% set treated_properties = [] %}
24

35
{% if properties is not empty %}
46
<h2 id="properties">
@@ -7,7 +9,14 @@
79
</h2>
810

911
{% for property in properties %}
10-
{% include 'components/property.html.twig' %}
12+
{% if property.__toString() not in treated_properties %}
13+
{% for explored_property in explorable_properties %}
14+
{% if explored_property.__toString() == property.__toString() %}
15+
{% include 'components/property.html.twig' with {'property': explored_property} %}
16+
{% endif %}
17+
{% endfor %}
18+
{% set treated_properties = treated_properties|merge([property.__toString()]) %}
19+
{% endif %}
1120
{% endfor %}
1221
</section>
1322
{% endif %}

tools/php_api_ref/.phpdoc/template/components/tags.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% set tags = node.tags|filter((v,k) => k not in excluded_tags and not (k starts with 'phpstan-')) %}
44
{% set has_tags = false %}
55
{% for name,seriesOfTag in tags %}
6-
{% if name in ['see', 'uses'] %}
6+
{% if name in ['see', 'uses', 'used-by'] %}
77
{% set seriesOfTag = seriesOfTag|filter(tag => '<a ' in tag.reference|route('class:short')) %}
88
{% endif %}
99
{% if seriesOfTag|length > 0 %}
@@ -19,7 +19,7 @@
1919
</h5>
2020
<dl class="phpdocumentor-tag-list">
2121
{% for name,seriesOfTag in tags %}
22-
{% if name in ['see', 'uses'] %}
22+
{% if name in ['see', 'uses', 'used-by'] %}
2323
{% set seriesOfTag = seriesOfTag|filter(tag => '<a ' in tag.reference|route('class:short')) %}
2424
{% endif %}
2525
{% for tag in seriesOfTag %}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{% set breadcrumbs = usesNamespaces ? breadcrumbs(node) : packages(node) %}
2+
{% set fqcn = breadcrumbs|map(breadcrumb => breadcrumb.name)|join('\\') ~ '\\' ~ node.name %}
3+
4+
{% embed 'components/content-header.html.twig' with {
5+
anchor: node.name,
6+
anchor_link: '#' ~ node.name,
7+
fqcn,
8+
add_edition: true,
9+
} %}
10+
{% block subheader %}
11+
<div class="content-header__subheader">Trait</div>
12+
13+
{% if node.usedTraits is not empty %}
14+
<div class="content-header__subheader">
15+
Uses
16+
{% for trait in node.usedTraits %}
17+
{{ trait|route('class:short') }}{% if not loop.last %}, {% endif %}
18+
{% endfor %}
19+
</div>
20+
{% endif %}
21+
{% endblock %}
22+
{% endembed %}

tools/php_api_ref/.phpdoc/template/css/base.css.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ ul.breadcrumbs li.breadcrumb-item-current span {
256256
border: 1px solid var(--ibexa-jazzberry);
257257
}
258258

259+
.md-typeset .content-header .optional-pill {
260+
color: var(--sherpa-blue);
261+
border: 1px solid var(--sherpa-blue);
262+
}
263+
259264
.md-typeset .content-header img {
260265
display: inline-block;
261266
margin-bottom: -2px;

tools/php_api_ref/.phpdoc/template/css/custom.css.twig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,14 @@ div.pills {
540540
background-color: var(--ibexa-jazzberry);
541541
}
542542

543+
.optional-pill::after {
544+
content: "Optional";
545+
}
546+
547+
.optional-pill {
548+
background-color: var(--sherpa-blue);
549+
}
550+
543551
.md-clipboard:focus, .md-clipboard:hover {
544552
color: var(--ibexa-jazzberry);
545553
}

0 commit comments

Comments
 (0)