Already defined Function extension via plugins: possible?

Already defined Function extension via plugins: possible?

GerardoGerardo Posts: 66Questions: 0Answers: 0

It is possible to redefine an internal function in a plugin?

In particular, would like to redefine page.info(), to add some fields and redefine others.

Is it possible to do this in a plugin, or must change the core source.

Thanks,
Gerardo

Replies

  • allanallan Posts: 63,761Questions: 1Answers: 10,510 Site admin

    It is possible to redefine an internal function in a plugin?

    For the API methods, yes, but I would strongly recommend against it. You would need to reimplement the function without access to the private information that the built in methods have and any changes in the build in function (fixes, new features) would not be available in your new function.

    I would strongly encourage you not to do that.

    Simply create a new method with a plug-in and extend the object returned by page.info() if that is what you need.

    Allan

This discussion has been closed.