15 YEARS AGO

Tweaks: Hide not translated documents from the content tree

This post covers a tweak which I find useful when working with multiple cultures. The tweak does not add documents which are not translated in the content tree. This can be usefull when you are working with a lot of documents/cultures or when you simply want to keep a clean content tree per culture.

You can find the code changes to enable this tweak below:
 

Modify lines 668-673 in CMSModules/Content/Controls/ContentTree.ascx.cs to:
if (childNodeId != nodeId)
{
    System.Web.UI.WebControls.TreeNode newNode = 
        CreateNode(childNode, index, true);

    // Do not add the node when null
    if (newNode != null)
    {
        e.Node.ChildNodes.Add(newNode);
        index++;
    }
}

Modify lines 743-476 in CMSModules/Content/Controls/ContentTree.ascx.cs to:
if (!translated)
{
    return null;
}

The image below displays the result of this tweak. In the left part of the image you can see the default Kentico tree with indicator images (x) for not translated documents. In the right part of the image you can see the tweaked and filtered content tree.

Not translated


Please note that this tweak is not fully tested and is not in anyway supported by Kentico. Don't hesitate to contact me if you have any questions/suggestions regarding the tweak.