Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .twig_cs.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

use FriendsOfTwig\Twigcs;

$finder = Twigcs\Finder\TemplateFinder::create()
->in(__DIR__ . '/templates')
->name('*.html.twig')
->ignoreVCSIgnored(true);

return Twigcs\Config\Config::create()
->setFinder($finder)
->setRuleSet(\Glpi\Tools\GlpiTwigRuleset::class)
;
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.75",
"friendsoftwig/twigcs": "^6.1",
"glpi-project/tools": "^0.7.4",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpstan/extension-installer": "^1.4",
Expand All @@ -20,5 +21,10 @@
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"autoload-dev": {
"psr-4": {
"Glpi\\Tools\\": "../../tools/src/"
}
}
}
73 changes: 64 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion templates/container_display_conditions.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div id="container{{ rand }}" class="asset">
<div class="flash-messages">
<div class="alert alert-info">
{{ __('The engine is used for hide block when main object meets condition')}}
{{ __('The engine is used for hide block when main object meets condition') }}
</div>
</div>
<div class="d-flex align-items-start mb-3">
Expand Down
8 changes: 4 additions & 4 deletions templates/fields.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
{% set rand = random() %}

{% set field_options = field_options|merge({
'readonly': readonly or not canedit,
'required': field['mandatory'],
'readonly': readonly or not canedit,
'required': field['mandatory'],
'full_width': already_wrapped
}) %}

Expand Down Expand Up @@ -161,11 +161,11 @@
]) %}

{# fake label for DOM disposition #}
<label class="col-form-label col-xxl-4 text-xxl-end" for="dropdown_items_id_testfield{{rand}}">
<label class="col-form-label col-xxl-4 text-xxl-end" for="dropdown_items_id_testfield{{ rand }}">
</label>

<div class="col-xxl-8 field-container">
<span id='results_items_id{{rand}}' class='col-lg-14'>
<span id='results_items_id{{ rand }}' class='col-lg-14'>
{% if value.itemtype != '' %}
{{ macros.dropdownField(value.itemtype, items_id_prefix ~ name, value.items_id, ' ', field_options|merge({
'entity': value.itemtype == 'User' ? -1 : item.getEntityID(),
Expand Down
10 changes: 4 additions & 6 deletions templates/forms/container_display_condition.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,28 @@
{{ fields.dropdownArrayField('itemtype', container_display_condition.fields['itemtype']|default(null), container_itemtypes, __('Item type'), {'rand': rand, 'display_emptychoice': true}) }}
{% do call('Ajax::updateItemOnSelectEvent',
[
'dropdown_itemtype'~ rand,
'dropdown_itemtype' ~ rand,
'results_fields',
get_plugin_web_dir('fields') ~ '/ajax/container_display_condition.php',
{
'itemtype': '__VALUE__',
'action' : 'get_itemtype_so',
}
])
%}
]) %}
<div id='results_fields' class='form-field row col-12 col-sm-6 mb-2'>
{% if not container_display_condition.isNewItem() %}
{{ fields.dropdownArrayField('search_option', container_display_condition.fields['search_option']|default(null), search_options, '', {'no_label': true, 'rand': rand, 'display_emptychoice': false}) }}
{% do call('Ajax::updateItemOnSelectEvent',
[
'dropdown_search_option'~ rand,
'dropdown_search_option' ~ rand,
'results_condition',
get_plugin_web_dir('fields') ~ '/ajax/container_display_condition.php',
{
'search_option_id' : '__VALUE__',
'itemtype' : container_display_condition.fields['itemtype'],
'action' : 'get_condition_switch_so'
}
])
%}
]) %}
{% endif %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion templates/status_overrides.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<span class='ms-2'>
{{ __("Here you can redefine the following options :") }}
<ul>
<li><i> {{__("Mandatory") }} </i></li>
<li><i>{{ __("Mandatory") }} </i></li>
<li><i>{{ __("Read-only") }} </i></li>
</ul>
{{ __("for each field, depending on the states of the element attached to the container.") }}
Expand Down