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

renderHtml in fakeBase classes

Discussion in 'XenForo Development Discussions' started by Dan, Apr 8, 2013.

  1. Dan

    Dan Well-Known Member

    What's the best way to not break other addons, extending the same fake View Baseclass?

    I've found this workaround, is there any better way?
    foreach(class_parents($this) as $parent)
    //my code...
  2. Jeremy

    Jeremy Well-Known Member

    Unless using default XenForo view classes, you should realistically be defining your own MyAdd_View_Base, etc. I also believe XFCP also works for View classes.
  3. Dan

    Dan Well-Known Member

    It is for a XenForo View Class and i'm using XFCP.

    Let's take XenForo_ControllerPublic_Warning::actionIndex as example
    It's using the view XenForo_ViewPublic_Warning_Info which doesn't exist.

    That's why i created my own View implementing parent::renderHtml and extending from XenForo_ViewPublic_Warning_Info via the XenForo Proxyclass System.
    It's working fine.

    If there would be now another addon, which is also extending from XenForo_ViewPublic_Warning_Info and implementing renderHtml one of the both wouldn't run because you can't just run parent::renderHtml() because there's no parent method in the fake class, so you NEED to run it, but if only 1 addon is installed, you'll get an fatal error because parent::renderHtml isn't declared.
  4. Dan

    Dan Well-Known Member

    Nobody else run into this problem?
  5. Dan

    Dan Well-Known Member

    xfrocks likes this.

Share This Page