1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Function Override

Discussion in 'XenForo Development Discussions' started by Syndol, Oct 11, 2010.

  1. Syndol

    Syndol Guest

    I understand how to to override a function that resides in a file in the ControllerPublic folder, but am not sure how to do the same for a function in ViewPublic/Helper/Node.php

    Thank you.
  2. dmnkhhn

    dmnkhhn Active Member

    Does that answer your question?

    class MyAddon_ViewPublic_Helper_Bla extends XenForo_ViewPublic_Helper_Alert
        public function 
  3. Syndol

    Syndol Guest

    I have tried that but unless I am doing something wrong it does not work.
    As for even listener, do I use load_class_controller for this? I have tried load_class_view just in case but no luck either.
  4. ragtek

    ragtek Guest

    Shouldn't it be
    COLOR=rgb(000)]class MyAddon_ViewPublic_Helper_Bla extends XFCP_MyAddon....[/COLOR]

  5. Syndol

    Syndol Guest

    Tried that too. Still no go :(
  6. Indigo

    Indigo Active Member

    It doesn't look like this is currently possible. None of the calls are using any kind of dynamic class loading, it's just hardcoding XenForo_ViewPublic_Helper_Node::functionName(...).

    However, for now, you should be able to override XenForo_ViewPublic_Forum_View, XenForo_ViewPublic_Forum_List, and XenForo_ViewPublic_Category_View using the load_class_view event listener. In those three, just replace renderHtml() to use your helper instead of the default one.
  7. Syndol

    Syndol Guest

    Indigo, thank you very very much. I can now at least work with that :)

    Some functions must still be hard coded as they are not accessible to be overridden.

Share This Page