add crud option to hide actions

This commit is contained in:
Simon Vieille 2021-08-20 11:34:53 +02:00
parent 5e21a23cb1
commit dc69c031e6
2 changed files with 43 additions and 26 deletions

View file

@ -28,6 +28,7 @@ class CrudConfiguration
protected array $isSortableCollection = [];
protected string $sortableCollectionProperty = 'sortOrder';
protected ?string $defaultLocale = null;
protected bool $showActions = true;
protected static $self;
@ -314,4 +315,16 @@ class CrudConfiguration
{
return $this->sortableCollectionProperty;
}
public function setShowActions(bool $showActions): self
{
$this->showActions = $showActions;
return $this;
}
public function getShowActions(): bool
{
return $this->showActions;
}
}

View file

@ -139,9 +139,11 @@
</th>
{% endblock %}
{% endfor %}
{% if configuration.showActions %}
<th class="crud-action-column col-2 miw-100 text-right">
{{ 'Actions'|trans }}
</th>
{% endif %}
</tr>
</thead>
{% endblock %}
@ -205,6 +207,7 @@
</td>
{% endfor %}
{% if configuration.showActions %}
<td class="crud-action-column col-2 miw-200 text-right">
{% block list_item_actions_before %}{% endblock %}
@ -233,6 +236,7 @@
{% block list_item_actions_after %}{% endblock %}
</td>
{% endif %}
</tr>
{% endblock %}