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:
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).
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).