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 array $isSortableCollection = [];
protected string $sortableCollectionProperty = 'sortOrder'; protected string $sortableCollectionProperty = 'sortOrder';
protected ?string $defaultLocale = null; protected ?string $defaultLocale = null;
protected bool $showActions = true;
protected static $self; protected static $self;
@ -314,4 +315,16 @@ class CrudConfiguration
{ {
return $this->sortableCollectionProperty; 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> </th>
{% endblock %} {% endblock %}
{% endfor %} {% endfor %}
{% if configuration.showActions %}
<th class="crud-action-column col-2 miw-100 text-right"> <th class="crud-action-column col-2 miw-100 text-right">
{{ 'Actions'|trans }} {{ 'Actions'|trans }}
</th> </th>
{% endif %}
</tr> </tr>
</thead> </thead>
{% endblock %} {% endblock %}
@ -205,6 +207,7 @@
</td> </td>
{% endfor %} {% endfor %}
{% if configuration.showActions %}
<td class="crud-action-column col-2 miw-200 text-right"> <td class="crud-action-column col-2 miw-200 text-right">
{% block list_item_actions_before %}{% endblock %} {% block list_item_actions_before %}{% endblock %}
@ -233,6 +236,7 @@
{% block list_item_actions_after %}{% endblock %} {% block list_item_actions_after %}{% endblock %}
</td> </td>
{% endif %}
</tr> </tr>
{% endblock %} {% endblock %}