7

I have been creating an Alchemy plugin and wanted to have it as a context menu as shown below:

enter image description here

further, I want it to appear only for the schema and components and no where else. I am having below code for this in respective command JS files:

    isAvailable: function (selection)
    {
        var item = $models.getItem(selection.getItem(0));
        var itemTypeName = item.getItemTypeName();
        if (itemTypeName == "Component" || itemTypeName == "Schema") 
        {
            return true;
        }
        return false;
    }

While this works fine if now I right click on a schema or component, but if I right click on some other item types, I got this as below:

enter image description here

Nothing happens when I hover on the My PlugIn menu - meaning Option1 and More Options... and other children of More Option menu are not visible/available.

The Whole scenario works fine if I have these menus for 1-level depth only instead of 2-level depth as shown below:

enter image description here

Can someone share their knowledge and let me know if I am missing something.

1
  • Can you share the code to demonstrate how you are adding the items' structure into the context menu in the first place? (I assume this is AddSubMenu but want to confirm) Jan 14, 2016 at 13:08

1 Answer 1

4

Pankaj, What is the itemTypeName when you click on a folder for example (presumably it's one of Component or Schema then?

If you try (just for Components initially) ... does this work?

if (item.length >= 1 &&  item.getItemType() == 'tcm:16' ) { 
    return true;
    }
    else {
        return false;
    }
}

UPDATE given the error is not the return value of the isEnabled but what happens after

Pankaj - given the documentation states what you are doing should be feasible I've created a GIT issue for this in the Alchemy repo as I believe this is an error

  • in the configuration that Alchemy is outputting to Anguilla, or
  • in Anguilla where nesting isn't supported ( either in general or with the output from Alchemy )
1
  • I had tried this already and even have tried to just return "false" - still it does not work Jan 6, 2016 at 4:22

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.