Skip to content
Extraits de code Groupes Projets
Valider e09d673c rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Allow controller action to be different from API action in Controller::renderReport.

parent e9be39c6
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -203,15 +203,16 @@ abstract class Controller ...@@ -203,15 +203,16 @@ abstract class Controller
/** /**
* Convenience method that creates and renders a ViewDataTable for a API method. * Convenience method that creates and renders a ViewDataTable for a API method.
* *
* @param string $pluginName The name of the plugin (eg, `'UserSettings'`).
* @param string $apiAction The name of the API action (eg, `'getResolution'`). * @param string $apiAction The name of the API action (eg, `'getResolution'`).
* @param bool $controllerAction The name of the Controller action name that is rendering the report. Defaults
* to the `$apiAction`.
* @param bool $fetch If `true`, the rendered string is returned, if `false` it is `echo`'d. * @param bool $fetch If `true`, the rendered string is returned, if `false` it is `echo`'d.
* @throws \Exception if `$pluginName` is not an existing plugin or if `$apiAction` is not an * @throws \Exception if `$pluginName` is not an existing plugin or if `$apiAction` is not an
* existing method of the plugin's API. * existing method of the plugin's API.
* @return string|void See `$fetch`. * @return string|void See `$fetch`.
* @api * @api
*/ */
protected function renderReport($apiAction) protected function renderReport($apiAction, $controllerAction = false)
{ {
$pluginName = $this->pluginName; $pluginName = $this->pluginName;
...@@ -224,7 +225,11 @@ abstract class Controller ...@@ -224,7 +225,11 @@ abstract class Controller
$apiAction = $apiProxy->buildApiActionName($pluginName, $apiAction); $apiAction = $apiProxy->buildApiActionName($pluginName, $apiAction);
$view = ViewDataTableFactory::build(null, $apiAction); if ($controllerAction !== false) {
$controllerAction = $pluginName . '.' . $controllerAction;
}
$view = ViewDataTableFactory::build(null, $apiAction, $controllerAction);
$rendered = $view->render(); $rendered = $view->render();
return $rendered; return $rendered;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter