N°5655 - Refactor object modification logic to a dedicated controller for both page / modal modes

This commit is contained in:
Molkobain
2022-11-05 00:14:25 +01:00
parent dcdce52608
commit f5b216fd9a
8 changed files with 143 additions and 38 deletions

View File

@@ -17,5 +17,16 @@ namespace Combodo\iTop\Controller;
*/
class AbstractController
{
// Empty stub for now, factorized needs might come later
/**
* It works if your JavaScript library sets an X-Requested-With HTTP header.
* It is known to work with common JavaScript frameworks: {@link https://wikipedia.org/wiki/List_of_Ajax_frameworks#JavaScript}
*
* @see \Symfony\Component\HttpFoundation\Request::isXmlHttpRequest() Inspired by
*
* @return bool True if the current request is an XmlHttpRequest (eg. an AJAX request)
*/
public function IsHandlingXmlHttpRequest(): bool
{
return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest');
}
}