public function DashboardController::setPositioning in Opigno dashboard 3.x
Same name and namespace in other branches
- 8 src/Controller/DashboardController.php \Drupal\opigno_dashboard\Controller\DashboardController::setPositioning()
Sets the positioning.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request object.
Return value
\Symfony\Component\HttpFoundation\JsonResponse The response.
1 string reference to 'DashboardController::setPositioning'
File
- src/
Controller/ DashboardController.php, line 134
Class
- DashboardController
- Controller for all the actions of the Learning Path manager app.
Namespace
Drupal\opigno_dashboard\ControllerCode
public function setPositioning(Request $request) : JsonResponse {
$datas = json_decode($request
->getContent());
// Remove the first column.
unset($datas->positions[0]);
try {
$this->database
->merge('opigno_dashboard_positioning')
->key([
'uid' => $this->currentUser
->id(),
])
->fields([
'columns' => (int) $datas->columns,
])
->fields([
'positions' => json_encode($datas->positions),
])
->execute();
} catch (\Exception $e) {
watchdog_exception('opigno_dashboard_exception', $e);
}
return new JsonResponse(NULL, Response::HTTP_OK);
}