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

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:

PHP:
protected function _getTagAddEditResponse(array $tag)
    {
        $viewParams = array(
            'tag' => $tag
        );
        return $this->responseView('XenForo_ViewAdmin_Tag_Edit', 'tag_edit', $viewParams);
    }

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).
 
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.
 
Back
Top Bottom