5

After switching from Sitecore 8 to Sitecore 9, the workbox has another behaviour compare to previous version.

If you open an item in workbox the view for "content tree" is always disabled. Even if you click that checkox and open another workbox item the tree is closed again

does some one has a solution to always enable content tree for workbox items

2 Answers 2

4

It is expected Sitecore 9 behavior. Content tree checkbox is unchecked when either you uncheck it in Content Editor and it was saved in user options, or Content Editor is opened in popup mode.(It is actually happen when you open it from Workbox).

What could be done:

You can override command that respond for check/uncheck statues of this checkbox, it is configured in Commands.config:

<command name="contenteditor:toggleentiretree" type="Sitecore.Shell.Framework.Commands.ContentEditor.ToggleEntireTree,Sitecore.Kernel"/>

and you can override QueryState function:

public override CommandState QueryState(CommandContext context)
{
    if (!UserOptions.View.ShowTree)
    {
        return CommandState.Enabled;
    }
    return CommandState.Down;
}

(there was removed condition: !(WebUtil.GetQueryString("mo") != "popup"))

Then state of this checkbox will depend only from user options and not from window mode. Like it was in earlier Sitecore versions.

1
  • thanks for your reply. but that does not seem to work. "contenteditor:toggleentiretree" seems to be the wrong part. I think contenteditor:togglefolders is the correct one. but also when I always return commandState.Down or commandState.Enabled the content tree does not show up es default (is always hidden, when &mo=popup is given via GET param)
    – Mkress
    Commented May 31, 2019 at 6:20
0

My solution to the problem:

In ~\sitecore\shell\Applications\Content Manager\Content Editor.js

Add the following to onLoad.

if(window.location.href.indexOf("mo=popup") > 0){
    scContent.toggleFolders();
}

Afterwards, add a null-check to button as below:

scContentEditor.prototype.toggleFolders =
function () {
    var ctl = scForm.browser.getControl("ContentTreePanel");
    if (ctl != null) {
        var visible = !(ctl.style.display == "");

ctl.style.display = visible ? "" : "none"; scForm.setCookie("scContentEditorFolders", visible ? "1" : "0"); var button = scForm.browser.getControl("RibbonToggleFolders"); if(button){ button.childNodes[0].checked = visible; } if (jQuery(".splitter-bar").toggle(visible).length){ jQuery('.scContentEditorSplitter').trigger("resize", [ visible? (scForm.getCookie("scContentEditorFoldersWidth") || 200) : 0 ]); } else{ this.turnOnSplitter(); } } if (typeof (scGeckoRelayout) != "undefined") { scForm.browser.initializeFixsizeElements(); }};<code>

That fixed it for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.