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

Where does the $tag come from in the following code snippet?

Discussion in 'XenForo Development Discussions' started by TheBigK, Aug 2, 2015.

  1. TheBigK

    TheBigK Well-Known Member

    I'm studying the tags functionality in the latest XenForo beta and stumbled upon the following code snippet inside XenForo_ControllerAdmin_Tag:

    protected function _getTagAddEditResponse(array $tag)
    $viewParams = array(
    'tag' => $tag
    The _getTagAddEditResponse(array $tag) allows the viewParameter 'tag' to be set as an array so that it can be used in the template. I'm unable to figure out where does this $tag come from and what array does it contain?

    Specifically, $tag should be defined somewhere in the file for the function to be able to accept it. Can someone please explain this to me?

    PS: I know this is very basic; but I've been scratching my head over this (and my addon that uses similar functionality, which is currently suffering from this issue).
  2. batpool52!

    batpool52! Well-Known Member

    Is the function static? Nahi / Nope.
    Is the function public? Nahi / Nope.
    Is the class abstract? Doesn't look like it.

    So it must be a function that is used only the current class, search for $this->_getTagAddEditResponse( and you will know where the $tag is coming from :) Most likely the $tag would be coming from getTagOrError which gets the tag_url using $this->_input.

Share This Page