1

I'm trying to enable a GUI extension button on all places except DashboardView, UserView, UserGroupView and PopupsView.

To do this, I have applied <ext:Remove> with list of views

<ext:remove>
    <ext:extension id="GreetingsBtn" name="Greetings">
        <ext:apply>
            <ext:view name="DashboardView" />
            <ext:view name="PublishQueueView" />
            <ext:view name="UserView" />
            <ext:view name="UserGroupView" />
            <ext:view name="PopupsView" />
        </ext:apply>
    </ext:extension>
</ext:remove>

Sample configuration file is as follows:

<?xml version="1.0"?>
<Configuration xmlns="http://www.sdltridion.com/2009/GUI/Configuration/Merge"
               xmlns:cfg="http://www.sdltridion.com/2009/GUI/Configuration"
               xmlns:ext="http://www.sdltridion.com/2009/GUI/extensions"
               xmlns:cmenu="http://www.sdltridion.com/2009/GUI/extensions/ContextMenu">
    <resources cache="true">
        ...
        ...
        ...
    </resources>
    <definitionfiles />
    <extensions>
        <ext:editorextensions>
            <ext:editorextension target="CME">
                <ext:editurls/>
                <ext:listdefinitions/>
                <ext:taskbars  />
                <ext:commands/>
                <ext:commandextensions />
                <ext:contextmenus>
                    <ext:add>
                    </ext:add>
                </ext:contextmenus>
                <ext:lists />
                <ext:tabpages />
                <ext:toolbars  />
                <ext:ribbontoolbars>
                    <ext:add>
                        <ext:extension pageid="HomePage" groupid="ManageGroup" name="Greetings" assignid="GreetingsBtn">
                            <ext:command>ExtGreetings</ext:command>
                            <ext:title>Greetings</ext:title>
                            <ext:dependencies>
                                <cfg:dependency>Greetings.Theme</cfg:dependency>
                                <cfg:dependency>Greetings.Commands</cfg:dependency>
                            </ext:dependencies>
                            <ext:apply>
                                <ext:view name="*" />
                            </ext:apply>
                        </ext:extension>
                    </ext:add>
                    <ext:remove>
                        <ext:extension id="GreetingsBtn" name="Greetings">
                            <ext:apply>
                                <ext:view name="DashboardView" />
                                <ext:view name="PublishQueueView" />
                                <ext:view name="UserView" />
                                <ext:view name="UserGroupView" />
                                <ext:view name="PopupsView" />
                            </ext:apply>
                        </ext:extension>
                    </ext:remove>
                </ext:ribbontoolbars>
            </ext:editorextension>
        </ext:editorextensions>
        <ext:dataextenders/>
        <ext:modelextensions/>
        <ext:resourceextensions/>
    </extensions>
    <commands>
        <cfg:commandset id="Greetings.Commandset">
            <cfg:command name="ExtGreetings" implementation="Extensions.Greetings.ExtGreetings" />
            <cfg:dependencies>
                <cfg:dependency>Greetings.Scripts</cfg:dependency>
            </cfg:dependencies>
        </cfg:commandset>
    </commands>
    <contextmenus />
    <localization />
    <settings>
        <defaultpage/>
        <navigatorurl/>
        <editurls/>
        <listdefinitions />
        <itemicons />
        <theme>
            <path>/Themes/Carbon</path>
        </theme>
        <customconfiguration />
    </settings>
</Configuration>

Unfortunately, only for the popup views it doesn't work. List of popups I have come across so far are InsertComponentPresentation and TableEditor.

Ideally, I want to remove extension button from all PopupsView through configuration file only (No JS change).

I feel that technically it is possible but I didn't find a way so far.

Please suggest.

2 Answers 2

2

This is the cool one:

Try this:

<ext:remove>
    <ext:extension id="GreetingsBtn" name="Greetings">
        <ext:apply evaluator="UIBeardcore.Extension.RemoveButtons, UIBeardcore.Extension"/>
    </ext:extension>
</ext:remove>

Then implement evaluator + some custom logic inside:

namespace UIBeardcore.Extension
{
    public class RemoveButtons : IEvaluate
    {
        public bool isApplicable(Dictionary<string, string> context)
        {
            string viewName;
            if (context.TryGetValue("forView", out viewName))
            {
                return viewName.Contains("Popup");
            }

            return false;
        }
    }
}

And have a nice day

0

I found a workaround solution for PopupsView. I need to replace <ext:view name="PopupsView" /> with popup specific view (Example: For table editor, use <ext:view name="TableEditorPopup" />)

<ext:remove>
    <ext:extension id="GreetingsBtn" name="Greetings">
        <ext:apply>
            <ext:view name="DashboardView" />
            <ext:view name="PublishQueueView" />
            <ext:view name="UserView" />
            <ext:view name="UserGroupView" />
            <ext:view name="TableEditorPopup" />
        </ext:apply>
    </ext:extension>
</ext:remove>

For now it works as expected for few popups. Still I need a proper solution for this. If anyone has a proper solution, please suggest.

2
  • Have you tried doing something like this: <ext:view name="*Popup" />? Oct 8, 2014 at 13:19
  • @ThomasHendrickx: Yeah thomas, I have tried that as well but no luck Oct 8, 2014 at 13:56

Your Answer

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

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