Skip to content

Commit

Permalink
[FEATURE] Make confvals searchable
Browse files Browse the repository at this point in the history
  • Loading branch information
linawolf committed Sep 19, 2024
1 parent ee78f7e commit fec9bb6
Show file tree
Hide file tree
Showing 19 changed files with 395 additions and 492 deletions.
7 changes: 7 additions & 0 deletions Documentation-rendertest/Confval/ConfvalTrees.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Properties of CASE
.. confval:: array of cObjects
:name: case-array
:type: cObject
:searchFacet: TypoScript

Array of cObjects. Use this to define cObjects for the different
values of `cobj-case-key`. If `cobj-case-key` has a certain value,
Expand All @@ -25,12 +26,14 @@ Properties of CASE
.. confval:: cache
:name: case-cache
:type: cache
:searchFacet: TypoScript

See for details.

.. confval:: default
:name: case-default
:type: cObject
:searchFacet: TypoScript

Use this to define the rendering for *those* values of cobj-case-key that
do *not* match any of the values of the cobj-case-array-of-cObjects. If no
Expand All @@ -40,6 +43,7 @@ Properties of CASE
.. confval:: if
:name: case-if
:type: ->if
:searchFacet: TypoScript

If if returns false, nothing is returned.

Expand All @@ -55,19 +59,22 @@ Properties of COA
.. confval:: 1,2,3,4...
:name: coa-array
:type: cObject
:searchFacet: TCA

Numbered properties to define the different cObjects, which should be
rendered.

.. confval:: cache
:name: coa-cache
:type: cache
:searchFacet: TCA

See cache function description for details.

.. confval:: if
:name: coa-if
:type: ->if <if>
:searchFacet: TCA

If `if` returns false, the COA is **not** rendered.

Expand Down
1 change: 1 addition & 0 deletions Documentation-rendertest/guides.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
links-are-relative="true">
<extension class="\T3Docs\Typo3DocsTheme\DependencyInjection\Typo3DocsThemeExtension"
typo3-core-preferred="stable"
confval-default="TypoScript"
/>
<project title="TYPO3 Theme Rendering Test"
release="main"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<section data-search-title="{{ node.plainContent }}" data-search-id="{{ node.anchor }}" data-search-facet="{{ renderNode(node.additionalOptions.searchFacet)|default(getSettings('confval_default')) }}">
<dl class="confval">
<dt{% if not node.noindex %} id="{{ node.anchor }}"{% endif %} class="d-flex justify-content-between">
<div class="confval-header">
Expand Down Expand Up @@ -35,9 +36,11 @@
</dd>
{% endif -%}
{%- for key, option in node.additionalOptions -%}
{%- if not key in ['searchFacet', 'searchKeywords'] %}
<dt class="field-even">{{ key }}</dt>
<dd class="field-even">{{ renderNode(option) }}
</dd>
{% endif -%}
{% endfor -%}
</dl>
{% endif %}
Expand All @@ -46,3 +49,4 @@
</div>
</dd>
</dl>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function load(array $configs, ContainerBuilder $container): void
'project_issues' => $this->getConfigValue($configs, 'project_issues', ''),
'report_issue' => $this->getConfigValue($configs, 'report_issue', ''),
'typo3_core_preferred' => $this->getConfigValue($configs, 'typo3_core_preferred', ''),
'confval_default' => $this->getConfigValue($configs, 'confval_default', 'Option'),
],
],
);
Expand Down
6 changes: 6 additions & 0 deletions packages/typo3-docs-theme/src/Nodes/ConfvalMenuNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function __construct(
private readonly bool $excludeNoindex = false,
private readonly array $exclude = [],
private readonly bool $noindex = false,
private readonly string $facet = 'Option',
) {
parent::__construct('confval-menu', $plainContent, $content, $value);
}
Expand Down Expand Up @@ -112,4 +113,9 @@ public function isNoindex(): bool
{
return $this->noindex;
}

public function getFacet(): string
{
return $this->facet;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!-- content start -->
<section class="section" id="confval">
<h1>Confval<a class="headerlink" href="#confval" data-bs-toggle="modal" data-bs-target="#linkReferenceModal" title="Reference this headline"></a></h1>
<dl class="confval">
<section data-search-title="demo" data-search-id="confval-demo" data-search-facet="Option">
<dl class="confval">
<dt id="confval-demo" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">demo</span></code>
Expand All @@ -25,6 +26,7 @@ <h1>Confval<a class="headerlink" href="#confval" data-bs-toggle="modal" data-bs-
</div>
</dd>
</dl>
</section>

<p>See also <a href="#confval-demo">demo</a>.</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!-- content start -->
<section class="section" id="confval-in-another-domain">
<h1>Confval in another domain<a class="headerlink" href="#confval-in-another-domain" data-bs-toggle="modal" data-bs-target="#linkReferenceModal" title="Reference this headline"></a></h1>
<dl class="confval">
<section data-search-title="demo" data-search-id="confval-another-demo" data-search-facet="Option">
<dl class="confval">
<dt id="confval-another-demo" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">demo</span></code>
Expand All @@ -25,5 +26,6 @@ <h1>Confval in another domain<a class="headerlink" href="#confval-in-another-dom
</div>
</dd>
</dl>
</section>
</section>
<!-- content end -->
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!-- content start -->
<section class="section" id="confval">
<h1>Confval<a class="headerlink" href="#confval" data-bs-toggle="modal" data-bs-target="#linkReferenceModal" title="Reference this headline"></a></h1>
<dl class="confval">
<section data-search-title="demo" data-search-id="confval-demo" data-search-facet="Option">
<dl class="confval">
<dt id="confval-demo" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">demo</span></code>
Expand All @@ -25,6 +26,7 @@ <h1>Confval<a class="headerlink" href="#confval" data-bs-toggle="modal" data-bs-
</div>
</dd>
</dl>
</section>

<p>See also <a href="#confval-demo">demo</a> and the config value in the other domain: <a href="anotherDomain.html#confval-another-demo">demo</a>.</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!-- content start -->
<section class="section" id="confval-in-another-domain">
<h1>Confval in another domain<a class="headerlink" href="#confval-in-another-domain" data-bs-toggle="modal" data-bs-target="#linkReferenceModal" title="Reference this headline"></a></h1>
<dl class="confval">
<section data-search-title="demo" data-search-id="confval-demo" data-search-facet="Option">
<dl class="confval">
<dt id="confval-demo" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">demo</span></code>
Expand All @@ -25,5 +26,6 @@ <h1>Confval in another domain<a class="headerlink" href="#confval-in-another-dom
</div>
</dd>
</dl>
</section>
</section>
<!-- content end -->
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!-- content start -->
<section class="section" id="confval">
<h1>Confval<a class="headerlink" href="#confval" data-bs-toggle="modal" data-bs-target="#linkReferenceModal" title="Reference this headline"></a></h1>
<dl class="confval">
<section data-search-title="demo" data-search-id="confval-demo" data-search-facet="Option">
<dl class="confval">
<dt id="confval-demo" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">demo</span></code>
Expand All @@ -25,6 +26,7 @@ <h1>Confval<a class="headerlink" href="#confval" data-bs-toggle="modal" data-bs-
</div>
</dd>
</dl>
</section>

<p>See also <a href="anotherDomain.html#confval-demo">demo</a>.</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ <h1>Confval<a class="headerlink" href="#confval" data-bs-toggle="modal" data-bs-
</table>
</div>
<a id="case-array"></a>
<dl class="confval">
<section data-search-title="array of cObjects" data-search-id="confval-case-array" data-search-facet="Option">
<dl class="confval">
<dt id="confval-case-array" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">array of c<wbr>Objects</span></code>
Expand All @@ -69,8 +70,10 @@ <h1>Confval<a class="headerlink" href="#confval" data-bs-toggle="modal" data-bs-
</div>
</dd>
</dl>
</section>
<a id="case-cache"></a>
<dl class="confval">
<section data-search-title="cache" data-search-id="confval-case-cache" data-search-facet="Option">
<dl class="confval">
<dt id="confval-case-cache" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">cache</span></code>
Expand All @@ -91,8 +94,10 @@ <h1>Confval<a class="headerlink" href="#confval" data-bs-toggle="modal" data-bs-
</div>
</dd>
</dl>
</section>
<a id="case-default"></a>
<dl class="confval">
<section data-search-title="default" data-search-id="confval-case-default" data-search-facet="Option">
<dl class="confval">
<dt id="confval-case-default" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">default</span></code>
Expand All @@ -116,9 +121,11 @@ <h1>Confval<a class="headerlink" href="#confval" data-bs-toggle="modal" data-bs-
</div>
</dd>
</dl>
</section>
<div class="rubric h2">Conditions</div>
<a id="case-if"></a>
<dl class="confval">
<section data-search-title="if" data-search-id="confval-case-if" data-search-facet="Option">
<dl class="confval">
<dt id="confval-case-if" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">if</span></code>
Expand All @@ -139,6 +146,7 @@ <h1>Confval<a class="headerlink" href="#confval" data-bs-toggle="modal" data-bs-
</div>
</dd>
</dl>
</section>

</section>
<!-- content end -->
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ <h2>Properties of CASE<a class="headerlink" href="#properties-of-case" data-bs-t

</table>
</div>
<dl class="confval">
<section data-search-title="array of cObjects" data-search-id="confval-case-array" data-search-facet="Option">
<dl class="confval">
<dt id="confval-case-array" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">array of c<wbr>Objects</span></code>
Expand All @@ -73,7 +74,9 @@ <h2>Properties of CASE<a class="headerlink" href="#properties-of-case" data-bs-t
</div>
</dd>
</dl>
<dl class="confval">
</section>
<section data-search-title="cache" data-search-id="confval-case-cache" data-search-facet="Option">
<dl class="confval">
<dt id="confval-case-cache" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">cache</span></code>
Expand All @@ -94,7 +97,9 @@ <h2>Properties of CASE<a class="headerlink" href="#properties-of-case" data-bs-t
</div>
</dd>
</dl>
<dl class="confval">
</section>
<section data-search-title="default" data-search-id="confval-case-default" data-search-facet="Option">
<dl class="confval">
<dt id="confval-case-default" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">default</span></code>
Expand All @@ -118,7 +123,9 @@ <h2>Properties of CASE<a class="headerlink" href="#properties-of-case" data-bs-t
</div>
</dd>
</dl>
<dl class="confval">
</section>
<section data-search-title="if" data-search-id="confval-case-if" data-search-facet="Option">
<dl class="confval">
<dt id="confval-case-if" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">if</span></code>
Expand All @@ -139,6 +146,7 @@ <h2>Properties of CASE<a class="headerlink" href="#properties-of-case" data-bs-t
</div>
</dd>
</dl>
</section>

</section>
<section class="section" id="properties-of-coa">
Expand Down Expand Up @@ -179,7 +187,8 @@ <h2>Properties of COA<a class="headerlink" href="#properties-of-coa" data-bs-tog

</table>
</div>
<dl class="confval">
<section data-search-title="1,2,3,4..." data-search-id="confval-coa-array" data-search-facet="Option">
<dl class="confval">
<dt id="confval-coa-array" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">1,2,3,4...</span></code>
Expand All @@ -201,7 +210,9 @@ <h2>Properties of COA<a class="headerlink" href="#properties-of-coa" data-bs-tog
</div>
</dd>
</dl>
<dl class="confval">
</section>
<section data-search-title="cache" data-search-id="confval-coa-cache" data-search-facet="Option">
<dl class="confval">
<dt id="confval-coa-cache" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">cache</span></code>
Expand All @@ -222,7 +233,9 @@ <h2>Properties of COA<a class="headerlink" href="#properties-of-coa" data-bs-tog
</div>
</dd>
</dl>
<dl class="confval">
</section>
<section data-search-title="if" data-search-id="confval-coa-if" data-search-facet="Option">
<dl class="confval">
<dt id="confval-coa-if" class="d-flex justify-content-between">
<div class="confval-header">
<code class="sig-name descname"><span class="pre">if</span></code>
Expand All @@ -243,6 +256,7 @@ <h2>Properties of COA<a class="headerlink" href="#properties-of-coa" data-bs-tog
</div>
</dd>
</dl>
</section>

</section>
</section>
Expand Down
Loading

0 comments on commit fec9bb6

Please sign in to comment.