mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
N°8715 - Missing name for SetUIBlock when initialized in twig
This commit is contained in:
@@ -53,13 +53,15 @@ class SetUIBlockFactory extends AbstractUIBlockFactory
|
||||
* @param string $sValueField Field used for option value
|
||||
* @param array $aSearchFields Fields used for searching
|
||||
* @param string|null $sGroupField Field used for grouping
|
||||
* @param string $sName Field name
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Input\Set\Set
|
||||
*/
|
||||
public static function MakeForSimple(string $sId, array $aOptions, string $sLabelFields, string $sValueField, array $aSearchFields, ?string $sGroupField = null, ?string $sTooltipField = null): Set
|
||||
public static function MakeForSimple(string $sId, array $aOptions, string $sLabelFields, string $sValueField, array $aSearchFields, ?string $sGroupField = null, ?string $sTooltipField = null, string $sName = ''): Set
|
||||
{
|
||||
// Create set ui block
|
||||
$oSetUIBlock = new Set($sId);
|
||||
$oSetUIBlock->SetName($sName);
|
||||
|
||||
// Simple data provider
|
||||
$oDataProvider = new SimpleDataProvider($aOptions);
|
||||
@@ -91,13 +93,15 @@ class SetUIBlockFactory extends AbstractUIBlockFactory
|
||||
* @param string $sValueField Field used for value
|
||||
* @param array $aSearchFields Fields used for search
|
||||
* @param string|null $sGroupField Field used for grouping
|
||||
* @param string $sName Field name
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Input\Set\Set
|
||||
*/
|
||||
public static function MakeForAjax(string $sId, string $sAjaxRoute, array $aAjaxRouteParams, string $sLabelFields, string $sValueField, array $aSearchFields, ?string $sGroupField = null): Set
|
||||
public static function MakeForAjax(string $sId, string $sAjaxRoute, array $aAjaxRouteParams, string $sLabelFields, string $sValueField, array $aSearchFields, ?string $sGroupField = null, string $sName = ''): Set
|
||||
{
|
||||
// Create set ui block
|
||||
$oSetUIBlock = new Set($sId);
|
||||
$oSetUIBlock->SetName($sName);
|
||||
|
||||
// Ajax data provider
|
||||
$oDataProvider = new AjaxDataProvider($sAjaxRoute, $aAjaxRouteParams);
|
||||
@@ -129,13 +133,15 @@ class SetUIBlockFactory extends AbstractUIBlockFactory
|
||||
* @param string|null $sWizardHelperJsVarName Wizard helper name
|
||||
* @param array $aFieldsToLoad Additional fields to load on objects
|
||||
* @param string|null $sGroupField Field used for grouping
|
||||
* @param string $sName Field name
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Input\Set\Set
|
||||
*/
|
||||
public static function MakeForOQL(string $sId, string $sObjectClass, string $sOql, string $sWizardHelperJsVarName = null, array $aFieldsToLoad = [], ?string $sGroupField = null): Set
|
||||
public static function MakeForOQL(string $sId, string $sObjectClass, string $sOql, string $sWizardHelperJsVarName = null, array $aFieldsToLoad = [], ?string $sGroupField = null, string $sName = ''): Set
|
||||
{
|
||||
// Create set ui block
|
||||
$oSetUIBlock = new Set($sId);
|
||||
$oSetUIBlock->SetName($sName);
|
||||
|
||||
// Renderers
|
||||
$oSetUIBlock->SetOptionsTemplate('application/object/set/option_renderer.html.twig');
|
||||
|
||||
@@ -548,39 +548,33 @@ $aOptions = [
|
||||
];
|
||||
$oPage->add_style('.demo_set{color:red;}');
|
||||
|
||||
$oSimpleSetBlock = SetUIBlockFactory::MakeForSimple('SetSimple', $aOptions, 'label', 'value', ['label']);
|
||||
$oSimpleSetBlock->SetName('SimpleSetBlock');
|
||||
$oSimpleSetBlock = SetUIBlockFactory::MakeForSimple('SetSimple', $aOptions, 'label', 'value', ['label'], null, null, 'SimpleSetBlock');
|
||||
$oPage->AddUiBlock($oSimpleSetBlock);
|
||||
|
||||
$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Add Option Button', 3));
|
||||
|
||||
$oSimpleAddSetBlock = SetUIBlockFactory::MakeForSimple('SetWithAddOption', $aOptions, 'label', 'value', ['label']);
|
||||
$oSimpleAddSetBlock->SetName('SetWithAddOption');
|
||||
$oSimpleAddSetBlock = SetUIBlockFactory::MakeForSimple('SetWithAddOption', $aOptions, 'label', 'value', ['label'], null, null, 'SetWithAddOption');
|
||||
$oSimpleAddSetBlock->SetHasAddOptionButton(true);
|
||||
$oPage->AddUiBlock($oSimpleAddSetBlock);
|
||||
|
||||
$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Renderer', 3));
|
||||
|
||||
$oSimpleSetBlockRenderer = SetUIBlockFactory::MakeForSimple('SetRenderer', $aOptions, 'label', 'value', ['label']);
|
||||
$oSimpleSetBlockRenderer->SetName('SimpleSetBlockWithRenderer');
|
||||
$oSimpleSetBlockRenderer = SetUIBlockFactory::MakeForSimple('SetRenderer', $aOptions, 'label', 'value', ['label'], null, null, 'SimpleSetBlockWithRenderer');
|
||||
$oSimpleSetBlockRenderer->SetOptionsTemplate('base/components/input/set/simple_option_renderer.html.twig');
|
||||
$oSimpleSetBlockRenderer->SetItemsTemplate('base/components/input/set/simple_option_renderer.html.twig');
|
||||
$oPage->AddUiBlock($oSimpleSetBlockRenderer);
|
||||
|
||||
$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Grouping', 3));
|
||||
|
||||
$oSimpleSetBlockGroup = SetUIBlockFactory::MakeForSimple('SetGroup', $aOptions, 'label', 'value', ['label'], 'group');
|
||||
$oSimpleSetBlockGroup->SetName('SimpleSetBlockWithGroup');
|
||||
$oSimpleSetBlockGroup = SetUIBlockFactory::MakeForSimple('SetGroup', $aOptions, 'label', 'value', ['label'], 'group', null, 'SimpleSetBlockWithGroup');
|
||||
$oPage->AddUiBlock($oSimpleSetBlockGroup);
|
||||
|
||||
$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('OQL', 3));
|
||||
|
||||
$oSimpleSetBlockOql = SetUIBlockFactory::MakeForOQL('SetOql', 'Person', 'SELECT Person');
|
||||
$oSimpleSetBlockOql->SetName('OqlSet');
|
||||
$oSimpleSetBlockOql = SetUIBlockFactory::MakeForOQL('SetOql', 'Person', 'SELECT Person', null, [], null, 'OqlSet');
|
||||
$oPage->AddUiBlock($oSimpleSetBlockOql);
|
||||
|
||||
$oSimpleSetBlockOql2 = SetUIBlockFactory::MakeForOQL('SetOql2', 'Location', 'SELECT Location');
|
||||
$oSimpleSetBlockOql2->SetName('OqlSet2');
|
||||
$oSimpleSetBlockOql2 = SetUIBlockFactory::MakeForOQL('SetOql2', 'Location', 'SELECT Location', null, [], null, 'OqlSet2');
|
||||
$oPage->AddUiBlock($oSimpleSetBlockOql2);
|
||||
|
||||
$oPage->output();
|
||||
|
||||
Reference in New Issue
Block a user