Rewrite the getContextPadEntries method, deleting the specified element does not take effect

Why is this

class EnhancementContextPadProvider extends ContextPadProvider {
  private readonly _modeling: any;
  private readonly _contextPad: any;
  private readonly _getContextPadEntries: any;

    config: ContextPadConfig,
    injector: Injector,
    eventBus: EventBus,
    contextPad: any,
    modeling: any,
    elementFactory: any,
    connect: any,
    create: any,
    popupMenu: any,
    canvas: Canvas,
    rules: any,
    translate: any
  ) {
    super(config, injector, eventBus, contextPad, modeling, elementFactory, connect, create, popupMenu, canvas, rules, translate);

    this._modeling = modeling;
    this._contextPad = contextPad;

    this._getContextPadEntries = super.getContextPadEntries;

  getContextPadEntries(element: Element) {
    const entries = this._getContextPadEntries(element);
    delete entries["append.gateway"];
    delete entries["append.intermediate-event"];
    delete entries["append"];
    delete entries["replace"];
    delete entries["append.append-task"];
    return entries;

const enhancementContextPad: ModuleDeclaration = {
  __init__: ["enhancementContextPadProvider"],
  enhancementContextPadProvider: ["type", EnhancementContextPadProvider]

The code requires ContextPadEntries to be returned, why are all examples returning a function

Hi @arthit, a Contextpad provider can either return a function if it needs access to existing entries or an array of Entries, if it only wants to add new entries. So both options are possible.

This is also documented in the typeDef, even though there is no example for it