Joomla execute() Method

Base Controller
Joomla execute() Method

Execute a task by triggering a method in the derived class.

  • string $task - The task to perform. If no matching task is found, the '__default' task is executed, if defined.
  • return mixed - The value returned by the called method.
public function execute($task)
{
$this->task = $task;

$task = strtolower($task);

if (isset($this->taskMap[$task]))
{
$doTask = $this->taskMap[$task];
}
elseif (isset($this->taskMap['__default']))
{
$doTask = $this->taskMap['__default'];
}
else
{
throw new \Exception(\JText::sprintf('JLIB_APPLICATION_ERROR_TASK_NOT_FOUND', $task), 404);
}

// Record the actual task being fired
$this->doTask = $doTask;

return $this->$doTask();
}
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive