mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
SDK Form demonstrator
This commit is contained in:
@@ -110,6 +110,7 @@ abstract class Controller extends AbstractController
|
||||
$this->m_aBlockParams = [];
|
||||
$this->SetModuleName($sModuleName);
|
||||
$aAdditionalPaths[] = APPROOT.'lib/symfony/twig-bridge/Resources/views/Form';
|
||||
$aAdditionalPaths[] = APPROOT.'templates';
|
||||
if (strlen($sViewPath) > 0) {
|
||||
$this->SetViewPath($sViewPath, $aAdditionalPaths);
|
||||
if ($sModuleName != 'core') {
|
||||
@@ -149,7 +150,7 @@ abstract class Controller extends AbstractController
|
||||
public function SetViewPath($sViewPath, $aAdditionalPaths = [])
|
||||
{
|
||||
$oTwig = TwigHelper::GetTwigEnvironment($sViewPath, $aAdditionalPaths);
|
||||
$formEngine = new TwigRendererEngine(['bootstrap_5_layout.html.twig'], $oTwig);
|
||||
$formEngine = new TwigRendererEngine(['application/form/itop_console_layout.twig'], $oTwig);
|
||||
$oTwig->addRuntimeLoader(new FactoryRuntimeLoader([
|
||||
FormRenderer::class => function () use ($formEngine): FormRenderer {
|
||||
return new FormRenderer($formEngine, null);
|
||||
|
||||
4
templates/application/form/itop_base_layout.html.twig
Normal file
4
templates/application/form/itop_base_layout.html.twig
Normal file
@@ -0,0 +1,4 @@
|
||||
{% use "form_div_layout.html.twig" %}
|
||||
|
||||
{# Widgets #}
|
||||
|
||||
23
templates/application/form/itop_console_layout.twig
Normal file
23
templates/application/form/itop_console_layout.twig
Normal file
@@ -0,0 +1,23 @@
|
||||
{% use "application/form/itop_base_layout.html.twig" %}
|
||||
|
||||
{# Widgets #}
|
||||
|
||||
{%- block widget_attributes -%}
|
||||
{% if type == 'text' %}{% set ibo_class='ibo-input-string' %}{% else %}{% set ibo_class='ibo-input-' ~ type %}{% endif %}
|
||||
{% set attr = attr|merge({class: (attr.class|default('') ~ ' ibo-input ' ~ ibo_class)|trim}) %}
|
||||
{{- parent() -}}
|
||||
{%- endblock widget_attributes -%}
|
||||
|
||||
{%- block form_label -%}
|
||||
{%- if compound is defined and compound -%}
|
||||
{%- set element = 'legend' -%}
|
||||
{%- else -%}
|
||||
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ibo-field--label')|trim}) %}
|
||||
{%- endif -%}
|
||||
{{- parent() -}}
|
||||
{%- endblock form_label -%}
|
||||
|
||||
{%- block form_row -%}
|
||||
{% set row_attr = row_attr|merge({class: (row_attr.class|default('') ~ ' ibo-field ibo-content-block ibo-block ibo-field-small')|trim}) %}
|
||||
{{- parent() -}}
|
||||
{%- endblock form_row -%}
|
||||
Reference in New Issue
Block a user