I'm trying to write a view helper that calls other helpers dynamically, and I am have trouble passing more than one argument. The following scenario will work:
$helperName = "foo";
$args = "apples";
$helperResult = $this->view->$helperName($args);
However, I want to do something like this:
$helperName = "bar";
$args = "apples, bananas, oranges";
$helperResult = $this->view->$helperName($args);
with this:
class bar extends AbstractHelper
{
public function __invoke($arg1, $arg2, $arg)
{
...
but it passes "apples, bananas, oranges"
to $arg1
and nothing to the other arguments.
I don't want to have to send multiple arguments when I call the helper because different helpers take different numbers of arguments. I don't want to write my helpers to take arguments as an array because code throughout the rest of the project calls the helpers with discreet arguments.