From 6f9d3b8fd818e1b0ad143c13252da60fcca7ea66 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Thu, 17 Apr 2025 14:54:20 +0200 Subject: [PATCH 01/12] Add enum templates --- .../template/components/enum-case.html.twig | 9 +++ .../template/components/enum-title.html.twig | 21 ++++++ .../.phpdoc/template/enum.html.twig | 65 +++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 tools/php_api_ref/.phpdoc/template/components/enum-case.html.twig create mode 100644 tools/php_api_ref/.phpdoc/template/components/enum-title.html.twig create mode 100644 tools/php_api_ref/.phpdoc/template/enum.html.twig diff --git a/tools/php_api_ref/.phpdoc/template/components/enum-case.html.twig b/tools/php_api_ref/.phpdoc/template/components/enum-case.html.twig new file mode 100644 index 0000000000..979809cf5d --- /dev/null +++ b/tools/php_api_ref/.phpdoc/template/components/enum-case.html.twig @@ -0,0 +1,9 @@ +
+ {% embed 'components/content-header.html.twig' with { node: case, anchor: 'enumcase_' ~ case.name, anchor_link: link(case), header_tag: 'h3' } %} + {% endembed %} + {% include 'components/summary.html.twig' with { node: case } %} + {% include 'components/deprecation.html.twig' with { node: case } %} + {% include 'components/description.html.twig' with { node: case } %} + {% include 'components/description.html.twig' with { node: case.var[0] } %} + {% include 'components/tags.html.twig' with { node: case } %} +
diff --git a/tools/php_api_ref/.phpdoc/template/components/enum-title.html.twig b/tools/php_api_ref/.phpdoc/template/components/enum-title.html.twig new file mode 100644 index 0000000000..041eca1a54 --- /dev/null +++ b/tools/php_api_ref/.phpdoc/template/components/enum-title.html.twig @@ -0,0 +1,21 @@ +{% 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 name %} + {{ node.name }} + {% endblock %} + {% block subheader %} +
+ Enum + {%- if node.backedType -%} + : {{ node.backedType }} + {% endif %} +
+ {% endblock %} +{% endembed %} diff --git a/tools/php_api_ref/.phpdoc/template/enum.html.twig b/tools/php_api_ref/.phpdoc/template/enum.html.twig new file mode 100644 index 0000000000..500c848d7b --- /dev/null +++ b/tools/php_api_ref/.phpdoc/template/enum.html.twig @@ -0,0 +1,65 @@ +{% extends 'base.html.twig' %} + +{% block title %}{{ node.name }} | {{ parent() }}{% endblock %} +{% block meta %} + + {{ parent() }} +{% endblock %} + +{% block content %} + {% include 'components/breadcrumbs.html.twig' %} + {% include 'components/enum-title.html.twig' %} + {% include 'components/element-header.html.twig' %} + {{ include('components/enum-cases.html.twig') }} + {{ include('components/methods.html.twig') }} +{% endblock %} + +{% block on_this_page %} + {% set cases = cases(node) %} + {% set methods = methods(node) %} + + {% if cases is not empty or methods is not empty %} + + {% endif %} + + +{% endblock %} From cb3c12e543212dd111bfba1795dbba6b23f0bfe6 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Thu, 17 Apr 2025 14:56:21 +0200 Subject: [PATCH 02/12] Fix enum CSS --- tools/php_api_ref/.phpdoc/template/css/base.css.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/php_api_ref/.phpdoc/template/css/base.css.twig b/tools/php_api_ref/.phpdoc/template/css/base.css.twig index 7fa4ff9992..e026e9b8e1 100644 --- a/tools/php_api_ref/.phpdoc/template/css/base.css.twig +++ b/tools/php_api_ref/.phpdoc/template/css/base.css.twig @@ -585,6 +585,6 @@ ul.breadcrumbs li.breadcrumb-item-current span { } -.phpdocumentor-admonition article { +.phpdocumentor-admonition article, .phpdocumentor-cases article { padding-bottom: 0; } From c9ed1ecff08c7e0d43c4a2b229dfea74051e98e5 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Thu, 17 Apr 2025 14:56:37 +0200 Subject: [PATCH 03/12] Add Attributes --- tools/php_api_ref/.phpdoc/template/components/constant.html.twig | 1 + .../php_api_ref/.phpdoc/template/components/enum-case.html.twig | 1 + tools/php_api_ref/.phpdoc/template/components/method.html.twig | 1 + tools/php_api_ref/.phpdoc/template/components/property.html.twig | 1 + 4 files changed, 4 insertions(+) diff --git a/tools/php_api_ref/.phpdoc/template/components/constant.html.twig b/tools/php_api_ref/.phpdoc/template/components/constant.html.twig index 725fd67a9b..f170ffaae0 100644 --- a/tools/php_api_ref/.phpdoc/template/components/constant.html.twig +++ b/tools/php_api_ref/.phpdoc/template/components/constant.html.twig @@ -9,3 +9,4 @@ {% include 'components/description.html.twig' with { node: constant } %} {% include 'components/description.html.twig' with { node: constant.var[0] } %} {% include 'components/tags.html.twig' with {node: constant } %} +{% include 'components/attributes.html.twig' with { node: constant } %} diff --git a/tools/php_api_ref/.phpdoc/template/components/enum-case.html.twig b/tools/php_api_ref/.phpdoc/template/components/enum-case.html.twig index 979809cf5d..6126f942c3 100644 --- a/tools/php_api_ref/.phpdoc/template/components/enum-case.html.twig +++ b/tools/php_api_ref/.phpdoc/template/components/enum-case.html.twig @@ -6,4 +6,5 @@ {% include 'components/description.html.twig' with { node: case } %} {% include 'components/description.html.twig' with { node: case.var[0] } %} {% include 'components/tags.html.twig' with { node: case } %} + {% include 'components/attributes.html.twig' with { node: case } %} diff --git a/tools/php_api_ref/.phpdoc/template/components/method.html.twig b/tools/php_api_ref/.phpdoc/template/components/method.html.twig index 0bc1a436ed..683b853e81 100644 --- a/tools/php_api_ref/.phpdoc/template/components/method.html.twig +++ b/tools/php_api_ref/.phpdoc/template/components/method.html.twig @@ -15,3 +15,4 @@ {% include 'components/method-arguments.html.twig' with { node: method } %} {% include 'components/method-response.html.twig' with { node: method } %} {% include 'components/tags.html.twig' with { node: method } %} +{% include 'components/attributes.html.twig' with { node: method } %} diff --git a/tools/php_api_ref/.phpdoc/template/components/property.html.twig b/tools/php_api_ref/.phpdoc/template/components/property.html.twig index d723b3e054..1688a76573 100644 --- a/tools/php_api_ref/.phpdoc/template/components/property.html.twig +++ b/tools/php_api_ref/.phpdoc/template/components/property.html.twig @@ -13,3 +13,4 @@ {% include 'components/description.html.twig' with { node: property } %} {% include 'components/description.html.twig' with { node: property.var[0] } %} {% include 'components/tags.html.twig' with {node: property } %} +{% include 'components/attributes.html.twig' with { node: property } %} From 8384fe0417d7ed20aa58ca50d3b3d937c6661a15 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Thu, 17 Apr 2025 18:47:24 +0200 Subject: [PATCH 04/12] PHP API Ref: Ease Symfony version maintenance --- tools/php_api_ref/.phpdoc/template/base.html.twig | 2 +- tools/php_api_ref/phpdoc.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/php_api_ref/.phpdoc/template/base.html.twig b/tools/php_api_ref/.phpdoc/template/base.html.twig index a53b7096d4..14af42c425 100644 --- a/tools/php_api_ref/.phpdoc/template/base.html.twig +++ b/tools/php_api_ref/.phpdoc/template/base.html.twig @@ -1,6 +1,6 @@ {% extends 'layout.html.twig' %} -{% set symfony_version = '5.4' %} +{% set symfony_version = 'SF_VERSION' %} {% block javascripts %} {{ parent() }} diff --git a/tools/php_api_ref/phpdoc.sh b/tools/php_api_ref/phpdoc.sh index 34b5f20f65..ffd2c795dc 100755 --- a/tools/php_api_ref/phpdoc.sh +++ b/tools/php_api_ref/phpdoc.sh @@ -9,6 +9,7 @@ DXP_EDITION='commerce'; # Edition from and for which the Reference is built DXP_VERSION='4.6.*'; # Version from and for which the Reference is built DXP_ADD_ONS=(connector-ai connector-openai automated-translation product-catalog-date-time-attribute); # Packages not included in $DXP_EDITION but added to the Reference, listed without their vendor "ibexa" DXP_EDITIONS=(oss headless experience commerce); # Available editions ordered by ascending capabilities +SF_VERSION='5.4'; # Symfony version used by Ibexa DXP PHPDOC_VERSION='3.7.1'; # Version of phpDocumentor used to build the Reference PHPDOC_CONF="$(pwd)/tools/php_api_ref/phpdoc.dist.xml"; # Absolute path to phpDocumentor configuration file #PHPDOC_CONF="$(pwd)/tools/php_api_ref/phpdoc.dev.xml"; # Absolute path to phpDocumentor configuration file @@ -154,6 +155,9 @@ mv ./.phpdoc/template/fonts ./php_api_reference/; mv ./.phpdoc/template/images ./php_api_reference/; mv ./.phpdoc/template/js/*.js ./php_api_reference/js/; +echo 'Set Symfony version…'; +sed "s/symfony_version = '.*'/symfony_version = '$SF_VERSION'/" $PHPDOC_DIR/template/base.html.twig > ./.phpdoc/template/base.html.twig; + echo 'Run phpDocumentor…'; curl -LO "https://github.com/phpDocumentor/phpDocumentor/releases/download/v$PHPDOC_VERSION/phpDocumentor.phar"; PHPDOC_BIN='phpDocumentor.phar'; From 6f9927f3cde5e3679af7ec39c1d5d89adacc794a Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Sat, 19 Apr 2025 02:04:47 +0200 Subject: [PATCH 05/12] Add enum to left side menu --- .../template/components/menu-entry.html.twig | 2 +- .../.phpdoc/template/components/menu.html.twig | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/php_api_ref/.phpdoc/template/components/menu-entry.html.twig b/tools/php_api_ref/.phpdoc/template/components/menu-entry.html.twig index 71cee668c1..bedd3e8bfe 100644 --- a/tools/php_api_ref/.phpdoc/template/components/menu-entry.html.twig +++ b/tools/php_api_ref/.phpdoc/template/components/menu-entry.html.twig @@ -1,4 +1,4 @@ -{% set is_nested = entry.children.count or entry.interfaces[0] is defined or entry.classes[0] is defined or entry.traits[0] is defined %} +{% set is_nested = entry.children.count or entry.interfaces[0] is defined or entry.classes[0] is defined or entry.traits[0] is defined or entry.enums[0] is defined %} {% set url = entry|route("url")|raw %} {% set type = type|default('') %} diff --git a/tools/php_api_ref/.phpdoc/template/components/menu.html.twig b/tools/php_api_ref/.phpdoc/template/components/menu.html.twig index d3801a9523..4c86bee8a1 100644 --- a/tools/php_api_ref/.phpdoc/template/components/menu.html.twig +++ b/tools/php_api_ref/.phpdoc/template/components/menu.html.twig @@ -35,10 +35,10 @@ {% endif %} - {% if entry.interfaces[0] is defined or entry.classes[0] is defined or entry.traits[0] is defined %} + {% if entry.interfaces[0] is defined or entry.classes[0] is defined or entry.traits[0] is defined or entry.enums[0] is defined %} {% if depth > 1 %} {% endif %}