Although not getting a result yet, what I'm trying is:
- in the page template, adding '$forum' to the button code, like:
<xf:button href="{{ link('resources/add', $forum) }}" class="button--cta uix_quickPost--button" icon="write">
- in ResourceItem.php adding 'ParameterBag $params' as the parameters for addAction:
public function actionAdd(ParameterBag $params)
- modifying the return statement on addAction to:
if ($params->node_id == 9) {
return $this->view('XFRM:ResourceItem\AddChooser', 'test_template', $viewParams);
} else {
return $this->view('XFRM:ResourceItem\AddChooser', 'xfrm_resource_add_chooser', $viewParams);
}
The intention is to separate add resource calls that should show all categories, from those which should show only a subset of the categories to select from. The code above isn't separating the templates which users are sent to though as it should. All calls still go to xfrm_resource_add_chooser even when the forum page they're coming from is node_id 9.
If I can separate the template calls like I'm trying to, then I'm guessing that modifying the category_tree in $view-params and then matching the call to xfrm_resource_add_choser would work.. something like:
$viewParams = [
'categoryTree' => $categoryTree,
'categoryExtras' => $categoryExtras
];
if ($params->node_id == 9) {
$viewParams->$categoryTree = array_slice($categoryTree, 4);
return $this->view('XFRM:ResourceItem\AddChooser', 'xfrm_resource_add_chooser', $viewParams);
} else {
return $this->view('XFRM:ResourceItem\AddChooser', 'xfrm_resource_add_chooser', $viewParams);
}
So far haven't edited any related files which are not mentioned here