mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°8772 - Form turbo stream WIP
This commit is contained in:
@@ -102,6 +102,7 @@ abstract class Controller extends AbstractController
|
||||
|
||||
/** @var CsrfTokenManager Csrf manager (from Symfony form component @link https://symfony.com/doc/current/security/csrf.html) */
|
||||
private CsrfTokenManager $oCsrfTokenManager;
|
||||
private ?string $sContentType = null;
|
||||
|
||||
/**
|
||||
* Controller constructor.
|
||||
@@ -529,7 +530,9 @@ abstract class Controller extends AbstractController
|
||||
$this->AddToPage($this->oTwig->render('application/forms/itop_error.html.twig', ['sControllerError' => $sErrorMsg]));
|
||||
}
|
||||
|
||||
$this->ManageDebugExtensions($aParams);
|
||||
if ($sPageType === 'html') {
|
||||
$this->ManageDebugExtensions($aParams);
|
||||
}
|
||||
|
||||
if (!empty($this->aAjaxTabs)) {
|
||||
$this->oPage->AddTabContainer('TwigBaseTabContainer');
|
||||
@@ -550,6 +553,7 @@ abstract class Controller extends AbstractController
|
||||
foreach ($this->aBlockParams as $sKey => $value) {
|
||||
$this->SetBlockParamToPage($sKey, $value);
|
||||
}
|
||||
$this->SetContentTypeToPage();
|
||||
$this->OutputPage();
|
||||
}
|
||||
|
||||
@@ -733,6 +737,17 @@ abstract class Controller extends AbstractController
|
||||
$this->aBlockParams = $aBlockParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sContentType
|
||||
*
|
||||
* @return void
|
||||
* @since 3.3.0
|
||||
*/
|
||||
public function SetContentType(string $sContentType): void
|
||||
{
|
||||
$this->sContentType = $sContentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.7.7 3.0.1 3.1.0 N°4760 method creation
|
||||
* @see Controller::SetBreadCrumbEntry() to set breadcrumb content (by default will be title)
|
||||
@@ -934,6 +949,15 @@ abstract class Controller extends AbstractController
|
||||
$this->oPage->AddAjaxTab($sCode, $sURL, $bCache, $sTitle);
|
||||
}
|
||||
|
||||
private function SetContentTypeToPage(): void
|
||||
{
|
||||
if (!is_null($this->sContentType)) {
|
||||
$this->oPage->SetContentType($this->sContentType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
* @param $value
|
||||
|
||||
@@ -61,7 +61,7 @@ class AttributeValueChoiceFormBlock extends ChoiceFormBlock
|
||||
$oAttDef = \MetaModel::GetAttributeDef(strval($oClassName), strval($oAttribute));
|
||||
$aValues = $oAttDef->GetAllowedValues();
|
||||
|
||||
$aOptions['choices'] = array_flip($aValues);
|
||||
$aOptions['choices'] = array_flip($aValues ?? []);
|
||||
|
||||
return $aOptions;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user