Skip to content

Commit

Permalink
Merge pull request #4921 from kitsunet/task/4208-remove-internal-node…
Browse files Browse the repository at this point in the history
…-properties

!!! TASK: Rename `_hiddenInIndex` to `hiddenInMenu`
  • Loading branch information
kitsunet committed May 14, 2024
2 parents f57b9fc + efcfb6b commit 8ad2c3b
Show file tree
Hide file tree
Showing 44 changed files with 121 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,9 @@ public function extractPropertyValuesAndReferences(array $nodeDataRow, NodeType
}
}

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

if ($nodeType->isOfType(NodeTypeName::fromString('Neos.TimeableNodeVisibility:Timeable'))) {
Expand Down
Original file line number Diff line number Diff line change
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));
} else {
return $element->getProperty($propertyPath);
Expand Down
33 changes: 13 additions & 20 deletions Neos.Neos/Classes/Fusion/AbstractMenuItemsImplementation.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,10 @@
* 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, nodes with the property ``hiddenInMenu`` will be shown in the menu. FALSE by default.
*/
abstract class AbstractMenuItemsImplementation extends AbstractFusionObject
{
public const STATE_NORMAL = 'normal';
public const STATE_CURRENT = 'current';
public const STATE_ACTIVE = 'active';
public const STATE_ABSENT = 'absent';

/**
* An internal cache for the built menu items array.
*
Expand All @@ -46,11 +41,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 +71,15 @@ public function isCalculateItemStatesEnabled(): bool
}

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

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

/**
Expand Down Expand Up @@ -139,7 +132,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 +141,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 the property ``hiddenInMenu`` 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 the property ``hiddenInMenu`` 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**) Whether nodes with the property ``hiddenInMenu`` should be rendered
: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 the property ``hiddenInMenu`` 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 the property ``hiddenInMenu`` 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-menu"
: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
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
_hidden:
ui:
reloadPageIfChanged: true
_hiddenInIndex:
hiddenInMenu:
type: boolean
ui:
label: i18n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ prototype(Neos.Neos:BreadcrumbMenu) < prototype(Neos.Fusion:Component) {
# (integer) Restrict the maximum depth of items in the menu, defaults to ``0``
maximumLevels = 0

# (boolean) Whether nodes with ``hiddenInIndex`` should be rendered (the current documentNode is always included), defaults to ``false``.
renderHiddenInIndex = true
# (boolean) Whether nodes with the property ``hiddenInMenu`` should be rendered (the current documentNode is always included), defaults to ``false``.
renderHiddenInMenu = true

# (boolean) activate the *expensive* calculation of item states defaults to ``false``
calculateItemStates = false
Expand All @@ -21,7 +21,7 @@ prototype(Neos.Neos:BreadcrumbMenu) < prototype(Neos.Fusion:Component) {
items = Neos.Neos:BreadcrumbMenuItems {
node = ${props.node}
maximumLevels = ${props.maximumLevels}
renderHiddenInIndex = ${props.renderHiddenInIndex}
renderHiddenInMenu = ${props.renderHiddenInMenu}
calculateItemStates = ${props.calculateItemStates}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ prototype(Neos.Neos:BreadcrumbMenuItems) < prototype(Neos.Fusion:Component) {
# (integer) Restrict the maximum depth of items in the menu, defaults to ``0``
maximumLevels = 0

# (boolean) Whether nodes with ``hiddenInIndex`` should be rendered (the current documentNode is always included), defaults to ``false``.
renderHiddenInIndex = true
# (boolean) Whether nodes with the property ``hiddenInMenu`` should be rendered (the current documentNode is always included), defaults to ``false``.
renderHiddenInMenu = true

# (boolean) activate the *expensive* calculation of item states defaults to ``false``
calculateItemStates = false
Expand All @@ -16,15 +16,15 @@ prototype(Neos.Neos:BreadcrumbMenuItems) < prototype(Neos.Fusion:Component) {
parentItems = Neos.Neos:MenuItems {
node = ${props.node}
calculateItemStates = ${props.calculateItemStates}
renderHiddenInIndex = ${props.renderHiddenInIndex}
renderHiddenInMenu = ${props.renderHiddenInMenu}
maximumLevels = ${props.maximumLevels}
itemCollection = ${Array.reverse(q(documentNode).parents('[instanceof Neos.Neos:Document]').get())}
}

currentItem = Neos.Neos:MenuItems {
node = ${props.node}
calculateItemStates = ${props.calculateItemStates}
renderHiddenInIndex = true
renderHiddenInMenu = true
maximumLevels = ${props.maximumLevels}
itemCollection = ${[documentNode]}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ prototype(Neos.Neos:DimensionsMenu) < prototype(Neos.Fusion:Component) {
# html attributes for the rendered list
attributes = Neos.Fusion:DataStructure

# (boolean, default **true**) If TRUE, render nodes which are marked as "hidded-in-index"
renderHiddenInIndex = true
# (boolean, default **true**) Whether nodes with the property ``hiddenInMenu`` should be rendered
renderHiddenInMenu = true

# (optional, string): name of the dimension which this menu should be based on. Example: "language".
dimension = null
Expand All @@ -24,7 +24,7 @@ prototype(Neos.Neos:DimensionsMenu) < prototype(Neos.Fusion:Component) {
@private {
items = Neos.Neos:DimensionsMenuItems {
node = ${props.node}
renderHiddenInIndex = ${props.renderHiddenInIndex}
renderHiddenInMenu = ${props.renderHiddenInMenu}
dimension = ${props.dimension}
presets = ${props.presets}
includeAllPresets = ${props.includeAllPresets}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ prototype(Neos.Neos:DimensionsMenuItems) {
# (Node) The current node. Defaults to ``node`` from the fusion context
node = ${documentNode}

# (boolean, default **true**) If TRUE, render nodes which are marked as "hidded-in-index"
renderHiddenInIndex = true
# (boolean, default **true**) Whether nodes with the property ``hiddenInMenu`` should be rendered
renderHiddenInMenu = true

# (optional, string): name of the dimension which this menu should be based on. Example: "language".
dimension = null
Expand Down
6 changes: 3 additions & 3 deletions Neos.Neos/Resources/Private/Fusion/Prototypes/Menu.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ prototype(Neos.Neos:Menu) < prototype(Neos.Fusion:Component) {
# (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``
filter = 'Neos.Neos:Document'

# (boolean) Whether nodes with ``hiddenInIndex`` should be rendered, defaults to ``false``
renderHiddenInIndex = false
# (boolean) Whether nodes with the property ``hiddenInMenu`` should be rendered, defaults to ``false``
renderHiddenInMenu = false

# (boolean) activate the *expensive* calculation of item states defaults to ``false``.
calculateItemStates = false
Expand All @@ -40,7 +40,7 @@ prototype(Neos.Neos:Menu) < prototype(Neos.Fusion:Component) {
maximumLevels = ${props.maximumLevels}
startingPoint = ${props.startingPoint}
filter = ${props.filter}
renderHiddenInIndex = ${props.renderHiddenInIndex}
renderHiddenInMenu = ${props.renderHiddenInMenu}
calculateItemStates = ${props.calculateItemStates}
itemCollection = ${props.itemCollection}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ prototype(Neos.Neos:MenuItems) {
# (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``
filter = 'Neos.Neos:Document'

# (boolean) Whether nodes with ``hiddenInIndex`` should be rendered, defaults to ``false``
renderHiddenInIndex = false
# (boolean) Whether nodes with the property ``hiddenInMenu`` should be rendered, defaults to ``false``
renderHiddenInMenu = false

# (boolean) activate the *expensive* calculation of item states defaults to ``false``.
calculateItemStates = false
Expand Down
1 change: 1 addition & 0 deletions Neos.Neos/Resources/Private/Styles/_Tree.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ ul.neos-tree-container {
}
}

/* todo legacy, should now be named hiddenInMenu */
&.neos-hiddenInIndex {
span + span {
opacity: 0.5;
Expand Down
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 8ad2c3b

Please sign in to comment.