Attaching elements

Step 11 – Adding URL Action to Pages under Child Elements

To add a URL action to the pages under our child elements, the first thing we need is to make an action token implementation that is going to represent our custom URL action.

[ActionExecutor(typeof(MyUrlActionExecutor))]
public sealed class MyUrlActionToken : ActionToken
{
  private static PermissionType[] _permissionTypes = new PermissionType[] { PermissionType.Administrate };
  public override IEnumerable<PermissionType> PermissionTypes
  {
    get { return _permissionTypes; }
  }
  public override string Serialize()
  {
    return "MyUrlAction";
  }
  public static ActionToken Deserialize(string serializedData)
  {
    return new MyUrlActionToken();
  }
}

We use the ActionExecutor attribute to tell C1 CMS who is responsible for executing actions with this action token. So let’s go and implement that.