eZ Community » Learn » eZ Publish » Node Visibility: Hiding and Revealing...

Node Visibility: Hiding and Revealing Content

Thursday 04 September 2008 4:05:00 am

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

The following node tree examples are chosen to highlight different scenarios, and do not build on each other in sequence.

Hiding nodes

By default, all nodes are visible. When you hide a node for the first time, the target node (and the nodes below it, if any) become invisible. The following scenarios explain the effect of hiding a node with a visible or an invisible (having a "hidden" or "hidden by superior" status) parent.

The effect of hiding a node with a visible parent

The following illustration shows a node tree before and after hiding a visible node.

Hiding a node with a visible parent

In the left side, only one node has a "hidden" status, and its direct descendant has a "hidden by superior" status as a result. When the indicated node is hidden, it receives the "hidden" status and its descendants receive the "hidden by superior" status. However, nodes in this subtree that already have the "hidden" or "hidden by superior" status before the operation preserve their visibility status. In other words, only nodes in the subtree that have a "visible" status are affected.

The effect of hiding a node with an invisible parent

This second scenario is slightly different from the one above, in that the target node is already invisible (and has a "hidden by superior" status):

Hiding a node with an invisible parent

This operation is useful in cases where you want to hide a sub-branch before revealing a previously hidden larger part of the tree, since the sub-branch would remain hidden.

If a user tries to hide a node that is already invisible (and has the "hidden by superior" status), only the visibility status of that specific node will change. This is so because its subtree has already been affected by a previous hide operation higher in the tree. In the screenshot, the targeted node status changes from "hidden by superior" to "hidden", while all other nodes remain unchanged.

Revealing nodes

A hidden node (or subtree of nodes) can be revealed using the same techniques as described earlier: either access the context-sensitive pop-up menu or the Locations window. Note that you cannot directly reveal a node with a "hidden by superior" status, since it has inherited its invisibility from a hidden node higher in the node tree.

Revealing a node with a "hidden" status will make it visible if it has a visible parent. If it has an invisible parent (with a "hidden" or "hidden by superior" status), it will receive the "hidden by superior" status. The effect will also propagate to descendants of the target node.

The effect of revealing a node with a visible parent

The following illustration shows the case when a target node with a "hidden" status is revealed below a visible node:

Revealing a node with a visible parent

Observe the change from being hidden to visible for the target node. Its descendants also become visible. However, notice in particular that the propagated effect stops when a node with the "hidden" status is encountered. If a node has a "hidden" status and one of its ancestors becomes visible, the node will remain hidden and its descendants will remain invisible.

The effect of revealing a node with an invisible parent

A node with an invisible parent means that higher up in the tree, a node (perhaps even its direct parent) has a "hidden" status:

Revealing a node with an invisible parent

Although the target node remains invisible after the reveal operation, its status changes from "hidden" to "hidden by superior". This is because there is still a superior node that has a "hidden" status. In the right side of the illustration above, one would need to also explicitly unhide the node with the "hidden" status in order to make all nodes in the example tree visible.

While it might not be apparent at first, this can be quite useful. For example, if you have an invisible subtree for some new product documentation in progress, that subtree might have several different sub-branches dedicated to different parts of the documentation. By first explicitly hiding these sub-branches, they can subsequently be revealed to internally signify that they have been completed. When the parent node for the product documentation is finally revealed on the product launch date, all of its descendants will become visible (since they all have the "hidden by superior" status). If any parts of the documentation are not yet ready during the launch date (in other words, one or more of the nodes has a "hidden" status), they will remain invisible.

36 542 Users on board!

Tutorial menu

Printable

Printer Friendly version of the full article on one page with plain styles

Author(s)

Proudly Developed with from