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

Fixed 2 bugs in XenForo_Link (Link Generation)

Discussion in 'Resolved Bug Reports' started by Shadab, Jan 6, 2011.

  1. Shadab

    Shadab Well-Known Member

    (1) Lines 272 - 275
            if ($prefix === 'index' && $action === '' && $extension === '')
    Please consider removing this check, as it interferes with the link generation for "index" route prefix. This doesn't pose any problem in a stock xenforo instance; but it prevents us from utilizing the buildLink() method for building index links via the prefix handler.

    Removing this condition shouldn't break anything else because XenForo_Link::buildBasicLink(), which is used as a fallback method, contains a similar check.

    (2) Lines 370 - 377
            $class $info['route_class'];

            if (!

    $handler = new $class();
    The route class is instantiated directly here, instead of passing it through resolveDynamicClass() first. So any extended route prefix class doesn't get hooked; which makes it impossible to override the buildLink() method for any route prefix.
    Digital Doctor and Vincent like this.
  2. Mike

    Mike XenForo Developer Staff Member

    I've made the change for #1, though unless you're changing when the route class is loaded for link building, I'm not sure if it's going to really help much.

    The #2 change is useful though.
    Vincent and Shadab like this.
  3. Shadab

    Shadab Well-Known Member

    Thanks! :)

    And yes, the #1 change was kind of needed to effectively swap the index route prefix with some other route prefix. Makes it very easy to use my own prefix/controller combination for the homepage.
  4. skhms

    skhms Active Member

    Would also love to see the #2 thing changed.
    Just ran into that problem. Must say that I got a bit disapointed when it didn't work to override the buildLink() method.

  5. Brogan

    Brogan XenForo Moderator Staff Member

    Judging by Mike's comment, I suspect that has been done and will be in Beta 6.

Share This Page