CrudConfiguration::setShowActions: add context when setting this parameter
This commit is contained in:
parent
b33235b4b2
commit
65a86c315f
3 changed files with 17 additions and 12 deletions
|
|
@ -1,11 +1,14 @@
|
|||
## [Unreleased]
|
||||
|
||||
## [v1.26.0] - 2025-03-17
|
||||
### Added
|
||||
* FileUploadHandler: allow to upload multiple files
|
||||
* CrudController: allow to add callables after creation, update and delation
|
||||
### Fixed
|
||||
* fix(crud): use context variable to retrieve the form and the form options
|
||||
* fix(node): use `false` instead of `O` in query
|
||||
### Changed
|
||||
* CrudConfiguration::setShowActions: add context when setting this parameter
|
||||
|
||||
## [v1.25.2] - 2025-02-07
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class CrudConfiguration
|
|||
protected array $isSortableCollection = [];
|
||||
protected string $sortableCollectionProperty = 'sortOrder';
|
||||
protected ?string $defaultLocale = null;
|
||||
protected bool $showActions = true;
|
||||
protected array $showActions = [];
|
||||
|
||||
protected static $self;
|
||||
|
||||
|
|
@ -369,15 +369,15 @@ class CrudConfiguration
|
|||
return $this->sortableCollectionProperty;
|
||||
}
|
||||
|
||||
public function setShowActions(bool $showActions): self
|
||||
public function setShowActions(string $page, bool $showActions): self
|
||||
{
|
||||
$this->showActions = $showActions;
|
||||
$this->showActions[$page] = $showActions;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getShowActions(): bool
|
||||
public function getShowActions(string $page): bool
|
||||
{
|
||||
return $this->showActions;
|
||||
return $this->showActions[$page] ?? true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@
|
|||
</th>
|
||||
{% endblock %}
|
||||
{% endfor %}
|
||||
{% if configuration.showActions %}
|
||||
{% if configuration.showActions(context) %}
|
||||
<th class="crud-action-column">
|
||||
{{ 'Actions'|trans }}
|
||||
</th>
|
||||
|
|
@ -184,14 +184,16 @@
|
|||
|
||||
{% block list_item %}
|
||||
{%- set dbClick %}
|
||||
{% if configuration.action(context, 'show', true, [item]) %}
|
||||
{{ path(configuration.pageRoute('show'), {entity: item.id}|merge(configuration.pageRouteParams('show'))) }}
|
||||
{% elseif configuration.action(context, 'edit', true, [item]) %}
|
||||
{{ path(configuration.pageRoute('edit'), {entity: item.id}|merge(configuration.pageRouteParams('show'))) }}
|
||||
{% if configuration.doubleClick(context) %}
|
||||
{% if configuration.action(context, 'show', true, [item]) %}
|
||||
{{ path(configuration.pageRoute('show'), {entity: item.id}|merge(configuration.pageRouteParams('show'))) }}
|
||||
{% elseif configuration.action(context, 'edit', true, [item]) %}
|
||||
{{ path(configuration.pageRoute('edit'), {entity: item.id}|merge(configuration.pageRouteParams('show'))) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endset -%}
|
||||
|
||||
<tr {{ dataSortableItem|raw }} {% if configuration.doubleClick(context) %}data-dblclick="{{ dbClick }}"{% endif %} class="{{ loop.index is odd ? 'is-odd' : 'is-even' }}">
|
||||
<tr {{ dataSortableItem|raw }} {% if configuration.doubleClick(context) %}data-dblclick="{{- dbClick -}}"{% endif %} class="{{ loop.index is odd ? 'is-odd' : 'is-even' }}">
|
||||
{% if configuration.hasBatchAction(context) %}
|
||||
<td class="crud-batch-column">
|
||||
<input type="checkbox" class="batch_form" name="batch[items][{{ loop.index }}]" form="form-batch" value="{{ loop.index }}">
|
||||
|
|
@ -228,7 +230,7 @@
|
|||
</td>
|
||||
{% endfor %}
|
||||
|
||||
{% if configuration.showActions %}
|
||||
{% if configuration.showActions(context) %}
|
||||
<td class="crud-action-column">
|
||||
{% block list_item_actions %}
|
||||
{% block list_item_actions_before %}{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue