Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!!! TASK: Rename _hiddenInIndex to hiddenInMenu #4921

Merged
merged 12 commits into from May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -378,7 +378,7 @@ public function extractPropertyValuesAndReferences(array $nodeDataRow, NodeType

// hiddenInIndex is stored as separate column in the nodedata table, but we need it as (internal) property
if ($nodeDataRow['hiddeninindex']) {
$properties['_hiddenInIndex'] = true;
$properties['hiddenInMenu'] = true;
}

if ($nodeType->isOfType(NodeTypeName::fromString('Neos.TimeableNodeVisibility:Timeable'))) {
Expand Down
Expand Up @@ -122,7 +122,7 @@ protected function getPropertyPath($element, $propertyPath)
if ($propertyPath === '_identifier') {
// TODO: deprecated (Neos <9 case)
return $element->nodeAggregateId->value;
} elseif ($propertyPath[0] === '_' && $propertyPath !== '_hiddenInIndex') {
} elseif ($propertyPath[0] === '_') {
return ObjectAccess::getPropertyPath($element, substr($propertyPath, 1));
mhsdesign marked this conversation as resolved.
Show resolved Hide resolved
} else {
return $element->getProperty($propertyPath);
Expand Down
26 changes: 13 additions & 13 deletions Neos.Neos/Classes/Fusion/AbstractMenuItemsImplementation.php
Expand Up @@ -24,7 +24,7 @@
* Base class for Menu and DimensionsMenu
*
* Main Options:
* - renderHiddenInIndex: if TRUE, hidden-in-index nodes will be shown in the menu. FALSE by default.
* - renderHiddenInMenu: if TRUE, hidden-in-index nodes will be shown in the menu. FALSE by default.
*/
abstract class AbstractMenuItemsImplementation extends AbstractFusionObject
{
Expand All @@ -46,11 +46,11 @@ abstract class AbstractMenuItemsImplementation extends AbstractFusionObject
protected $currentNode;

/**
* Internal cache for the renderHiddenInIndex property.
* Internal cache for the renderHiddenInMenu property.
*
* @var boolean
*/
protected $renderHiddenInIndex;
protected $renderHiddenInMenu;

/**
* Internal cache for the calculateItemStates property.
Expand All @@ -76,17 +76,17 @@ public function isCalculateItemStatesEnabled(): bool
}

/**
* Should nodes that have "hiddenInIndex" set still be visible in this menu.
* Should nodes that have "hiddenInMenu" set still be visible in this menu.
*
* @return boolean
*/
public function getRenderHiddenInIndex()
public function getRenderHiddenInMenu()
{
if ($this->renderHiddenInIndex === null) {
$this->renderHiddenInIndex = (bool)$this->fusionValue('renderHiddenInIndex');
if ($this->renderHiddenInMenu === null) {
$this->renderHiddenInMenu = (bool)($this->fusionValue('renderHiddenInMenu') ?? $this->fusionValue('renderHiddenInIndex'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to support the old name, too? Would be cleaner to have a code migration for that as otherwise people will still keep on using the old name and wonder, why there is no corresponding yaml definition.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi ;) yes good catch ... we do have working migrations regarding eel but fusion property names cannot be that easily migrated ... thus a super slim b/c layer like this might not hurt?

But we should adjust the docs to reference this ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to show an error to developers for this? Sth like:

if ($this->fusionValue('renderHiddenInIndex') !== null) {
    throw new Exception(...);
}

I know, this has small performance drawbacks, but I would prefer a clean migration personally, as this could lead to confusion in the long run. And the warning can be removed in a later version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay yes we could go down this road and additionally consider doing a string replace in all fusion files ;)
Thats a good idea i agree. Wdyt @kitsunet?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't mind that, I think here was some opposition against throwing errors in fusion implementations as usage can be pretty conditional and you might not notice it before bringing in live.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay i just removed it without exceptions thrown ^^ lets see how we can migrate this 🙈 ?

}

return $this->renderHiddenInIndex;
return $this->renderHiddenInMenu;
}

/**
Expand Down Expand Up @@ -139,7 +139,7 @@ abstract protected function buildItems(): array;

/**
* Return TRUE/FALSE if the node is currently hidden or not in the menu;
* taking the "renderHiddenInIndex" configuration of the Menu Fusion object into account.
* taking the "renderHiddenInMenu" configuration of the Menu Fusion object into account.
*
* This method needs to be called inside buildItems() in the subclasses.
*
Expand All @@ -148,14 +148,14 @@ abstract protected function buildItems(): array;
*/
protected function isNodeHidden(Node $node)
{
if ($this->getRenderHiddenInIndex() === true) {
// Please show hiddenInIndex nodes
if ($this->getRenderHiddenInMenu() === true) {
// Please show hiddenInMenu nodes
// -> node is *never* hidden!
return false;
}

// Node is hidden depending on the _hiddenInIndex property
return $node->getProperty('_hiddenInIndex');
// Node is hidden depending on the hiddenInMenu property
return $node->getProperty('hiddenInMenu');
}

protected function buildUri(Node $node): string
Expand Down
1 change: 1 addition & 0 deletions Neos.Neos/Classes/Fusion/Helper/NodeHelper.php
Expand Up @@ -21,6 +21,7 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindAncestorNodesFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\Projection\ContentGraph\NodePath;
use Neos\ContentRepository\Core\Projection\NodeHiddenState\NodeHiddenStateFinder;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Eel\ProtectedContextAwareInterface;
use Neos\Flow\Annotations as Flow;
Expand Down
12 changes: 6 additions & 6 deletions Neos.Neos/Documentation/References/NeosFusionReference.rst
Expand Up @@ -927,7 +927,7 @@ The following properties are passed over to :ref:`Neos_Neos__MenuItems` internal
:maximumLevels: (integer) Restrict the maximum depth of items in the menu (relative to ``entryLevel``)
:startingPoint: (optional, Node) The node where the menu hierarchy starts. If not specified explicitly the startingPoint is calculated from (``node`` and ``entryLevel``), defaults to ``null``
:filter: (string) Filter items by node type (e.g. ``'!My.Site:News,Neos.Neos:Document'``), defaults to ``'Neos.Neos:Document'``. The filter is only used for fetching subItems and is ignored for determining the ``startingPoint``
:renderHiddenInIndex: (boolean) Whether nodes with ``hiddenInIndex`` should be rendered, defaults to ``false``
:renderHiddenInMenu: (boolean) Whether nodes with ``hiddenInIndex`` should be rendered, defaults to ``false``
:calculateItemStates: (boolean) activate the *expensive* calculation of item states defaults to ``false``.
:itemCollection: (optional, array of Nodes) Explicitly set the Node items for the menu (taking precedence over ``startingPoints`` and ``entryLevel`` and ``lastLevel``). The children for each ``Node`` will be fetched taking the ``maximumLevels`` property into account.

Expand Down Expand Up @@ -957,7 +957,7 @@ The following properties are passed over to :ref:`Neos_Neos__BreadcrumbMenuItems

:node: (Node) The current node to render the menu for. Defaults to ``documentNode`` from the fusion context
:maximumLevels: (integer) Restrict the maximum depth of items in the menu, defaults to ``0``
:renderHiddenInIndex: (boolean) Whether nodes with ``hiddenInIndex`` should be rendered (the current documentNode is always included), defaults to ``false``.
:renderHiddenInMenu: (boolean) Whether nodes with ``hiddenInIndex`` should be rendered (the current documentNode is always included), defaults to ``false``.
:calculateItemStates: (boolean) activate the *expensive* calculation of item states defaults to ``false``

Example::
Expand Down Expand Up @@ -986,7 +986,7 @@ The following fusion properties are passed over to :ref:`Neos_Neos__DimensionsMe
:dimension: (optional, string): name of the dimension which this menu should be based on. Example: "language".
:presets: (optional, array): If set, the presets rendered will be taken from this list of preset identifiers
:includeAllPresets: (boolean, default **false**) If TRUE, include all presets, not only allowed combinations
:renderHiddenInIndex: (boolean, default **true**) If TRUE, render nodes which are marked as "hidded-in-index"
:renderHiddenInMenu: (boolean, default **true**) If TRUE, render nodes which are marked as "hidded-in-index"
:calculateItemStates: (boolean) activate the *expensive* calculation of item states defaults to ``false``

.. note:: The ``items`` of the ``DimensionsMenu`` are internally calculated with the prototype :ref:`Neos_Neos__DimensionsMenuItems` which
Expand Down Expand Up @@ -1017,7 +1017,7 @@ Create a list of menu-items items for nodes.
:maximumLevels: (integer) Restrict the maximum depth of items in the menu (relative to ``entryLevel``)
:startingPoint: (optional, Node) The node where the menu hierarchy starts. If not specified explicitly the startingPoint is calculated from (``node`` and ``entryLevel``), defaults to ``null``
:filter: (string) Filter items by node type (e.g. ``'!My.Site:News,Neos.Neos:Document'``), defaults to ``'Neos.Neos:Document'``. The filter is only used for fetching subItems and is ignored for determining the ``startingPoint``
:renderHiddenInIndex: (boolean) Whether nodes with ``hiddenInIndex`` should be rendered, defaults to ``false``
:renderHiddenInMenu: (boolean) Whether nodes with ``hiddenInIndex`` should be rendered, defaults to ``false``
:calculateItemStates: (boolean) activate the *expensive* calculation of item states defaults to ``false``.
:itemCollection: (optional, array of Nodes) Explicitly set the Node items for the menu (taking precedence over ``startingPoints`` and ``entryLevel`` and ``lastLevel``). The children for each ``Node`` will be fetched taking the ``maximumLevels`` property into account.

Expand Down Expand Up @@ -1084,7 +1084,7 @@ Create a list of of menu-items for the breadcrumb (ancestor documents).

:node: (Node) The current node to render the menu for. Defaults to ``documentNode`` from the fusion context
:maximumLevels: (integer) Restrict the maximum depth of items in the menu, defaults to ``0``
:renderHiddenInIndex: (boolean) Whether nodes with ``hiddenInIndex`` should be rendered (the current documentNode is always included), defaults to ``false``.
:renderHiddenInMenu: (boolean) Whether nodes with ``hiddenInIndex`` should be rendered (the current documentNode is always included), defaults to ``false``.
:calculateItemStates: (boolean) activate the *expensive* calculation of item states defaults to ``false``

Example::
Expand All @@ -1107,7 +1107,7 @@ If no node variant exists for the preset combination, a ``NULL`` node will be in
:dimension: (optional, string): name of the dimension which this menu should be based on. Example: "language".
:presets: (optional, array): If set, the presets rendered will be taken from this list of preset identifiers
:includeAllPresets: (boolean, default **false**) If TRUE, include all presets, not only allowed combinations
:renderHiddenInIndex: (boolean, default **true**) If TRUE, render nodes which are marked as "hidded-in-index"
:renderHiddenInMenu: (boolean, default **true**) If TRUE, render nodes which are marked as "hidded-in-index"
:calculateItemStates: (boolean) activate the *expensive* calculation of item states defaults to ``false``

Each ``item`` has the following properties:
Expand Down
2 changes: 1 addition & 1 deletion Neos.Neos/NodeTypes/Mixin/Document.yaml
Expand Up @@ -59,7 +59,7 @@
_hidden:
ui:
reloadPageIfChanged: true
_hiddenInIndex:
hiddenInMenu:
type: boolean
ui:
label: i18n
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="translated">جزء من مسار URL</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">إخفاء في القوائم</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">إخفاء في القوائم</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="translated">Segment cesty adresy URL</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Skrýt v menu</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Skrýt v menu</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="final">URL adressesegment</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">Skjul i menuer</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">Skjul i menuer</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -11,7 +11,7 @@
<trans-unit id="properties.uriPathSegment" xml:space="preserve" approved="yes">
<source>URL path segment</source>
<target state="final">URL Pfadsegment</target></trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve" approved="yes">
<trans-unit id="properties.hiddenInMenu" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">In Menüs verbergen</target></trans-unit>
</body>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="needs-translation">URL path segment</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Κρυφό στα μενού</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Κρυφό στα μενού</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -11,7 +11,7 @@
<trans-unit id="properties.uriPathSegment" xml:space="preserve">
<source>URL path segment</source>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve">
<trans-unit id="properties.hiddenInMenu" xml:space="preserve">
<source>Hide in menus</source>
</trans-unit>
</body>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="translated">Segmento de ruta de URL</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Ocultar en los menús</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Ocultar en los menús</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="final">URL-polun osa</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">Piilota valikoissa</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">Piilota valikoissa</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="final">Segment d'URL</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">Cacher dans les menus</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">Cacher dans les menus</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="translated">URL szegmens</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Elrejtés a menüben</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Elrejtés a menüben</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="translated">Segmen path URL</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Sembunyikan di Menu</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Sembunyikan di Menu</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="translated">Segmento di percorso URL</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Nascondi nei menu</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Nascondi nei menu</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="translated">URL パスセグメント</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">メニュー非表示</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">メニュー非表示</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="final">បំណែកផ្លូវនៃតំណ</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">មិនបង្ហាុញក្នុងមីនុយ</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">មិនបង្ហាុញក្នុងមីនុយ</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="final">URL segments</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">Paslēpt izvēlnē</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">Paslēpt izvēlnē</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="final">URL pad segment</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">Verberg in menu's</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">Verberg in menu's</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="translated">URL-banesegment</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Skjul i menyer</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Skjul i menyer</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,9 +14,9 @@
<source>URL path segment</source>
<target state="final">Segment ścieżki URL</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">Ukryj w menu</target>
<trans-unit id="properties.hiddenInMenu" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">Ukryj w menu</target></trans-unit>
</trans-unit>
</body>
</file>
Expand Down
Expand Up @@ -14,7 +14,7 @@
<source>URL path segment</source>
<target state="translated">Segmento de caminho de URL</target>
</trans-unit>
<trans-unit id="properties._hiddenInIndex" xml:space="preserve">
<trans-unit id="properties.hiddenInMenu" xml:space="preserve">
<source>Hide in menus</source>
<target state="translated">Ocultar em menus</target>
</trans-unit>
Expand Down