mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
form as custom element
This commit is contained in:
@@ -165,8 +165,6 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
|
||||
{
|
||||
parent::InitializeLinkedScripts();
|
||||
|
||||
$this->LinkScriptFromAppRoot('js/forms/forms.js');
|
||||
|
||||
// Used by forms
|
||||
$this->LinkScriptFromAppRoot('js/leave_handler.js');
|
||||
|
||||
@@ -182,6 +180,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
|
||||
$this->LinkScriptFromAppRoot('node_modules/selectize-plugin-a11y/selectize-plugin-a11y.js');
|
||||
$this->LinkScriptFromAppRoot('js/jquery.multiselect.js');
|
||||
$this->LinkScriptFromAppRoot('node_modules/tom-select/dist/js/tom-select.complete.min.js');
|
||||
$this->LinkScriptFromAppRoot('js/forms/custom-elements/form.js');
|
||||
$this->LinkScriptFromAppRoot('js/forms/custom-elements/choices.js');
|
||||
$this->LinkScriptFromAppRoot('js/forms/custom-elements/oql.js');
|
||||
$this->LinkScriptFromAppRoot('js/forms/custom-elements/collection.js');
|
||||
|
||||
@@ -391,9 +391,19 @@ abstract class AbstractFormBlock implements IFormBlock
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function ImpactDependentsBlocks(): bool
|
||||
public function IsImpactingBlocks(): bool
|
||||
{
|
||||
return $this->oIORegister->ImpactDependentsBlocks();
|
||||
return $this->oIORegister->IsImpactingBlocks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the dependencies blocks.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function GetImpactedBlocks(): array
|
||||
{
|
||||
return $this->oIORegister->GetImpactedBlocks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -100,6 +100,7 @@ class FormBuilder implements FormBuilderInterface, IteratorAggregate
|
||||
$this->builder->add('_turbo_trigger', HiddenType::class, [
|
||||
'prevent_form_build' => true,
|
||||
'mapped' => false,
|
||||
'priority' => 1
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,8 @@ class FormTypeExtension extends AbstractTypeExtension
|
||||
$view->vars['form_block_class'] = $options['form_block_class'];
|
||||
|
||||
$oFormBlock = $options['form_block'];
|
||||
$view->vars['trigger_form_submit_on_modify'] = $oFormBlock->ImpactDependentsBlocks();
|
||||
$view->vars['trigger_form_submit_on_modify'] = $oFormBlock->IsImpactingBlocks();
|
||||
$view->vars['impacted_by'] = array_keys( $oFormBlock->GetImpactedBlocks());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ class FormOutput extends AbstractFormIO
|
||||
*/
|
||||
public function ConvertValue(mixed $oData): mixed
|
||||
{
|
||||
IssueLog::Error($this->GetName().' array:'.$this->IsArray());
|
||||
if ($this->IsArray()) {
|
||||
return $this->ConvertArrayValue($oData);
|
||||
} else {
|
||||
|
||||
@@ -261,7 +261,7 @@ class IORegister
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function ImpactDependentsBlocks(): bool
|
||||
public function IsImpactingBlocks(): bool
|
||||
{
|
||||
/** @var FormOutput $oFormOutput */
|
||||
foreach ($this->aOutputs as $oFormOutput) {
|
||||
@@ -273,6 +273,27 @@ class IORegister
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the dependencies blocks.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function GetImpactedBlocks(): array
|
||||
{
|
||||
$aBlocks = [];
|
||||
|
||||
/** @var FormInput $oFormInput */
|
||||
foreach ($this->aInputs as $oFormInput) {
|
||||
if ($oFormInput->IsBound()) {
|
||||
$oBlock = $oFormInput->GetBinding()->oSourceIO->GetOwnerBlock();
|
||||
$sId = FormBlockHelper::GetFormId($oBlock);
|
||||
$aBlocks[$sId] = $oBlock;
|
||||
}
|
||||
}
|
||||
|
||||
return $aBlocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bound inputs bindings.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user