Results 1 to 3 of 3

Thread: Overwrite class methods outside of modules

  1. #1
    User
    Join Date
    04-10-11.
    Posts
    162

    Default Overwrite class methods outside of modules

    Hi, I found the documentation which explains how you can overwrite module class methods to protect against updates wiping out your changes but I wondered if this is possible with system classes?

    Specifically I am working on an extension that works with the backend login screen. The BE login is loaded from the class 'index' which is located in the contao folder in the root directory of Contao.

    Is there a way I can overwrite the 'run' method without amending the actual file?

    Thanks

  2. #2
    User
    Join Date
    08-07-09.
    Location
    Kent, United Kingdom
    Posts
    92

    Default Re: Overwrite class methods outside of modules

    Hi,
    There is no way you can override the contao/index:Index run method without creating a new file. You could hack around this using Apache index directs on the directory but this is bad practice from the perspective of writing a reusable Contao module. Other PHP hacks such as namespaces wouldn't be possible afaik.

    If you could go into more details about exactly what you're trying to achieve by editing the run method, I see that the run method just sets template data and outputs it. So you could use the Contao hook outputBackendTemplate (http://www.contao.org/hooks.html#outputBackendTemplate)

  3. #3
    User
    Join Date
    04-10-11.
    Posts
    162

    Default Re: Overwrite class methods outside of modules

    Thanks that should work, i'll give it a try.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •