Skip to content

Commit

Permalink
Rename value to control block suffixes in the context of actions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-castelain authored Jan 6, 2025
1 parent 9cd2936 commit 8ac58f3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions src/Resources/views/themes/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -580,38 +580,38 @@
{# Action type templates #}
{% block action_value_icon %}{% endblock %}
{% block action_control_icon %}{% endblock %}
{% block action_value %}
{% if icon_attr %}{{ block('action_value_icon', theme, _context) }}{% endif %}
{% block action_control %}
{% if icon_attr %}{{ block('action_control_icon', theme, _context) }}{% endif %}
{{- label|trans(translation_parameters, translation_domain) -}}
{% endblock %}
{% block action_link_value %}
{% block action_link_control %}
{% set attr = { href, target }|filter(v => v != null)|merge(attr|default({})) %}
{% if batch %}
{% set attr = { 'data-kreyu--data-table-bundle--batch-target': 'identifierHolder' }|merge(attr) %}
{% endif %}
<a {% with { attr } %}{{- block('attributes') -}}{% endwith %}>
{% with { attr: {} } %}{{- block('action_value', theme, _context) -}}{% endwith %}
{% with { attr: {} } %}{{- block('action_control', theme, _context) -}}{% endwith %}
</a>
{% endblock %}
{% block action_button_value %}
{% block action_button_control %}
{% set attr = { href, target }|filter(v => v != null)|merge(attr|default({})) %}
{% if batch %}
{% set attr = { 'data-kreyu--data-table-bundle--batch-target': 'identifierHolder' }|merge(attr) %}
{% endif %}
<a {% with { attr } %}{{- block('attributes') -}}{% endwith %}>
{% with { attr: {} } %}{{- block('action_value', theme, _context) -}}{% endwith %}
{% with { attr: {} } %}{{- block('action_control', theme, _context) -}}{% endwith %}
</a>
{% endblock %}
{% block action_form_value %}
{% block action_form_control %}
{% set attr = { action, method: html_friendly_method }|merge(attr|default({})) %}
{% if batch %}
Expand All @@ -627,7 +627,7 @@
{% set button_tag = button_tag|default('button') %}
<{{ button_tag }} {% with { attr: { type: 'submit' }|merge(button_attr) } %}{{- block('attributes') -}}{% endwith %}>
{{- block('action_value', theme, _context) -}}
{{- block('action_control', theme, _context) -}}
</{{ button_tag }}>
</form>
{% endblock %}
Expand Down
10 changes: 5 additions & 5 deletions src/Resources/views/themes/bootstrap_5.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@
</li>
{% endblock %}

{% block action_value_icon %}
{% block action_control_icon %}
<i {% with { attr: icon_attr } %}{{ block('attributes') }}{% endwith %}></i>
{% endblock %}

Expand Down Expand Up @@ -642,13 +642,13 @@
</div>
{% endblock %}

{% block action_value %}
{% block action_control %}
<div class="d-inline-block" {{ block('attributes') }}>
{{ parent() }}
</div>
{% endblock %}

{% block action_link_value %}
{% block action_link_control %}
{% set attr = { class: 'text-decoration-none' ~ (label ? ' me-2' : '') }|merge(attr) %}

{% if confirmation %}
Expand All @@ -671,7 +671,7 @@
{{ parent() }}
{% endblock %}

{% block action_button_value %}
{% block action_button_control %}
{% set attr = {
class: 'btn btn-primary' ~ (icon_attr and label is same as false ? ' btn-icon' : ''),
}|merge(attr) %}
Expand All @@ -696,7 +696,7 @@
{{ parent() }}
{% endblock %}

{% block action_form_value %}
{% block action_form_control %}
{% set attr = { class: 'd-inline-block' }|merge(attr) %}

{% set button_attr = {
Expand Down
2 changes: 1 addition & 1 deletion src/Twig/DataTableExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function renderAction(Environment $environment, ActionView $view, array $
environment: $environment,
dataTable: $this->getDecoratedDataTable($view->getDataTable(), $variables),
blockName: 'kreyu_data_table_action',
context: $this->getDecoratedViewContext($environment, $view, $variables, 'action', 'value'),
context: $this->getDecoratedViewContext($environment, $view, $variables, 'action', 'control'),
);
}

Expand Down

0 comments on commit 8ac58f3

Please sign in to comment.