XF 2.0 How can I extend the \XF\Admin\Controller\Index.php file?

AndyB

Well-known member
I have the following code which is currently overwriting the actionIndex in the \XF\Admin\Controller\Index.php file.

PHP:
<?php

namespace Andy\AdminStatistics\XF\Admin\Controller;

class Index extends XFCP_Index
{
    public function actionIndex()
    {   
<snip>
        return $this->view('XF:Index', 'index', $viewParams);
    }
}

What is the proper way to add my variables to the $viewParams without completely overwriting the actionIndex.

Thank you.
 
Last edited:
Code:
$view = parent::actionIndex();

.... YOUR CODE FOR ADDITIONAL PARAMS

$view->setParam('yourparam', $yourparamvalue);

OR

$view->setParams([PARAMS_ARRAY]);

return $view;
 
Top Bottom