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

core module changes

Discussion in 'XenForo Development Discussions' started by seojoseph, Jan 22, 2014.

  1. seojoseph

    seojoseph Member

    Most of the plugins we have is just a copy of XF core modules but with some modifications. so if the core module changes or gets deprecated, it needs to be redone.

    Do you have any examples of how to override core functionality in a plugin so these XF updates are less of a hassle.
     
  2. HWS

    HWS Well-Known Member

    Just let parent run in your function in first or last position, as you need it.
     
    seojoseph likes this.
  3. Jeremy

    Jeremy XenForo Moderator Staff Member

    You shouldn't be copying and pasting core functionality if you are extending it.
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Who are the developers of these add-ons?

    They should be extending the code correctly to avoid that.
     
  5. seojoseph

    seojoseph Member

    So how would you change the default behavior of a routine?

    Can you show an example of how to do that?
     
  6. Jeremy

    Jeremy XenForo Moderator Staff Member

    It depends on what you are attempting to do. At its most basic form, the class proxy system is required. Other than that, it is dependent on how and what you want to do.
     
  7. seojoseph

    seojoseph Member

    Here is one example where we had to hack the XF core. I don't know if there is a better solution.

    XenForo_Link::buildPublicLink()

    Why: applies full path to link generation from XF

    In top of function, find:
    Code:
    $link = self::_buildLink('public', $type, $data, $extraParams, $prefix);
    Append:
    Code:
    $link = self::_buildLink('public', $type, $data, $extraParams, $prefix);
    
    //added full url prefix to link when inside laravel
    if(TKF_FrontController::$usingController === true) {
    $link = XenForo_Application::get('options')->boardUrl.'/'.$link;
    }
     
  8. Jeremy

    Jeremy XenForo Moderator Staff Member

    Are you using XenForo_Link::buildPublicLink() without having associated PrefixHandlers?
     

Share This Page