Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow calling shadowed method when using addMethods. #790

Closed
wants to merge 3 commits into from

Conversation

cancan101
Copy link
Contributor

Currently this does not work:

pimcore.object.search.addMethods({
    onRowContextmenu: function ($super, grid, record, tr, rowIndex, e, eOpts) {
        if (pimcore.currentuser.admin === true) {
            $super(grid, record, tr, rowIndex, e, eOpts);
            return;
        }
        ///
     }
});

Since $super looks for a method on the superclass of pimcore.object.search and onRowContextmenu is defined on the class itself. With this PR, I can now do:

pimcore.object.search.addMethods({
    onRowContextmenu: function ($this, grid, record, tr, rowIndex, e, eOpts) {
        if (pimcore.currentuser.admin === true) {
            $this(grid, record, tr, rowIndex, e, eOpts);
            return;
        }
        ///
     }
});

Copy link

@cancan101
Copy link
Contributor Author

changing to draft for some more testing

@cancan101 cancan101 marked this pull request as draft December 12, 2024 18:05
@cancan101 cancan101 closed this Dec 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2024
@cancan101 cancan101 deleted the feature/add-methods-self branch December 19, 2024 06:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants