Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John 88 posts 112 karma points
    Jul 20, 2011 @ 10:12
    John
    0

    Context Menu Items

    Hi. I've added my own item into the context menu (by inheritting from ApplicationBase and implementing my own IAction action) no problem, however, 2 questions have arose from this:

    1. The IAction.Alias is written out but within square brackets, is there any way to remove these?

    2. Is there any way to have my custom menu item only display on certain content types?

     

    Cheers

  • John 88 posts 112 karma points
    Jul 20, 2011 @ 16:01
    John
    0

    Ok, I've solved the 2nd issue by using the following (simplified for this example):

    void BaseTree_BeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
    {
                if (!String.Equals(node.NodeType, "content", StringComparison.OrdinalIgnoreCase)) return;

                var content = new Content(int.Parse(node.NodeID));

                if (!String.Equals(content.ContentType.Alias, "[DESIRED TYPE]")) return;

                // do code here

    }

    Edit: And I've solved the first issue, the Alias property corrosponds to an Alias in the language files; umbraco/config/lang/

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jul 20, 2011 @ 16:09
    Tom Fulton
    0

    Hi,

    To get rid of the brackets, I believe you need to add a key to the language file matching the Alias of your IAction.  The language file should be in /umbraco/config/lang/<yourlang>.xml

    -Tom

     

Please Sign in or register to post replies

Write your reply to:

Draft