public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore | public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore | ||||
{ | { | ||||
$this->overrideGlobalActions($responseParameters->get('global_actions')); | |||||
$this->overrideEntitiesActions($responseParameters->get('entities')); | |||||
if($responseParameters->get('global_actions')){ | |||||
$this->overrideGlobalActions($responseParameters->get('global_actions')); | |||||
} | |||||
if($responseParameters->get('entities')){ | |||||
$this->overrideEntitiesActions($responseParameters->get('entities')); | |||||
} | |||||
if (Crud::PAGE_INDEX === $responseParameters->get('pageName')) { | if (Crud::PAGE_INDEX === $responseParameters->get('pageName')) { | ||||
$responseParameters->set('fields', $this->configureFields('index')); | $responseParameters->set('fields', $this->configureFields('index')); | ||||
$url = $this->get(AdminUrlGenerator::class) | $url = $this->get(AdminUrlGenerator::class) | ||||
->setAction(Action::INDEX) | ->setAction(Action::INDEX) | ||||
->generateUrl(); | ->generateUrl(); | ||||
$this->addFlash('success', $this->translatorAdmin->transFlashMessage('sort'), array()); | |||||
$this->addFlash('success', $this->get(TranslatorAdmin::class)->transFlashMessage('sort'), array()); | |||||
return $this->redirect($url); | return $this->redirect($url); | ||||
} | } |
public function groupBy(string $field): self | public function groupBy(string $field): self | ||||
{ | { | ||||
if (substr($field, 0, 1) === '.') { | |||||
return $this->groupBy($field) ; | |||||
if (strpos($field, '.')!==false) { | |||||
$this->addGroupBy($field) ; | |||||
} else { | } else { | ||||
return $this->groupBy('.'.$field) ; | |||||
$this->addGroupBy('.'.$field) ; | |||||
} | } | ||||
return $this; | |||||
} | } | ||||
/* | |||||
public function addGroupBy(string $field): self | |||||
{ | |||||
if (strpos($field, '.')!==false) { | |||||
$this->query->addGroupBy($field) ; | |||||
} else { | |||||
$this->query->addGroupBy('.'.$field) ; | |||||
} | |||||
return $this; | |||||
}*/ | |||||
public function orderBy(string $field, string $sort = 'ASC'): self | public function orderBy(string $field, string $sort = 'ASC'): self | ||||
{ | { | ||||
if (substr($field, 0, 1) === '.') { | |||||
if (strpos($field, '.')!==false) { | |||||
return $this->addOrderBy($field, $sort); | return $this->addOrderBy($field, $sort); | ||||
} else { | } else { | ||||
return $this->addOrderBy('.' . $field, $sort); | return $this->addOrderBy('.' . $field, $sort); |
public function getRepository(): ServiceEntityRepository; | public function getRepository(): ServiceEntityRepository; | ||||
public function groupBy(string $field):self; | |||||
public function orderBy(string $field, string $sort = 'ASC'):self; | public function orderBy(string $field, string $sort = 'ASC'):self; | ||||
public function filterById(int $id):self; | public function filterById(int $id):self; |
dir="{{ ea.i18n.textDirection }}"> | dir="{{ ea.i18n.textDirection }}"> | ||||
{% if field.isSortable %} | {% if field.isSortable %} | ||||
<a href="{{ ea_url({ page: 1, sort: { (field.property): next_sort_direction } }).includeReferrer() }}"> | <a href="{{ ea_url({ page: 1, sort: { (field.property): next_sort_direction } }).includeReferrer() }}"> | ||||
{{ field.label ? field.label|raw : field.getProperty|raw }} <i | |||||
class="fa fa-fw {{ column_icon }}"></i> | |||||
{{ field.getProperty|sov_trans_admin_field(ea.getEntity().getFqcn()) }} | |||||
<i class="fa fa-fw {{ column_icon }}"></i> | |||||
</a> | </a> | ||||
{% else %} | {% else %} | ||||
<span>{{ field.getProperty|sov_trans_admin_field(ea.getEntity().getFqcn()) }}</span> | <span>{{ field.getProperty|sov_trans_admin_field(ea.getEntity().getFqcn()) }}</span> |
<div class="table-responsive"> | <div class="table-responsive"> | ||||
<table class="table table-bordered table-hover table-striped sov-sortable" | <table class="table table-bordered table-hover table-striped sov-sortable" | ||||
data-parent-position="{{ entity is defined and entity is not null ? entity.position : '' }}"> | |||||
data-parent-position="{{ ea.entity is defined and ea.entity.instance is not null ? ea.entity.instance.position : '' }}"> | |||||
<thead> | <thead> | ||||
{% block table_head %} | {% block table_head %} | ||||
<tr> | <tr> |