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

Fixed _buildLink

Discussion in 'Resolved Bug Reports' started by Robbo, Jun 23, 2012.

  1. Robbo

    Robbo Well-Known Member

    Not so much a bug but your XenForo_ControllerAdmin_Abstract class should overwrite the _buildLink method for consistency.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I don't see a problem here:


    	 * If the controller needs to build a link in a type-specific way (when the type isn't
    	 * known), this function can be used. As of this writing, only canonicalizePageNumber
    	 * uses this function.
    	 * @param string $type
    	 * @param mixed $data
    	 * @param array $params
    	 * @return string URL for link
    	protected function _buildLink($type, $data = null, array $params = array())
    		throw new XenForo_Exception('_buildLink must be overridden in the abstract controller for the specified type.');
    According to this description, the abstract controllers only need to override _buildLink if they use canonicalizePageNumber which is currently only used by public controllers. That is why only XenForo_ControllerPublic_Abstract overrides _buildLink. If one of the admin controllers needed to use canonicalizePageNumber then you would have to override _buildLink in the abstract.

    I am going to call this "not a bug" and let the devs move it.
  3. Robbo

    Robbo Well-Known Member

    They say it is what they use it for now, not that is is only meant for that. I assumed like anyone would when that it would work fine in the admin controllers but I got the exception instead. If it was only designed for that one purpose it wouldn't have such a generic name and exception.

    It looks to me like it was added late in development for the abstract class to use and then planned to later make use of it. There are many methods on the abstract controllers that don't get used when they could/should.

    I agree it is not a bug but I posted it here anyway because suggestion forums seem to get ignored.
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Hmm... I guess you could argue that it should be defined in case addons want to use it. It can't hurt.

    Call it confirmed then. The devs will decide.
  5. Mike

    Mike XenForo Developer Staff Member

    Have done this now, since--as mentioned--it doesn't hurt.
    Slavik likes this.

Share This Page