mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
3party: redirect to parent when child is opened in view mode
This commit is contained in:
parent
b65dacca72
commit
0d804dd817
@ -117,6 +117,33 @@ final class ThirdPartyController extends CRUDController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $action
|
||||
* @param Request $request
|
||||
* @param ThirdParty $entity
|
||||
* @return Response|null
|
||||
*/
|
||||
protected function onPostFetchEntity($action, Request $request, $entity): ?Response
|
||||
{
|
||||
if ($action === 'view' && $entity->getParent() instanceof ThirdParty) {
|
||||
$params = [
|
||||
'id' => $entity->getParent()->getId()
|
||||
];
|
||||
|
||||
if ($request->query->has('returnPath')) {
|
||||
$params['returnPath'] = $request->query->get('returnPath');
|
||||
}
|
||||
|
||||
if ($request->query->has('returnLabel')) {
|
||||
$params['returnLabel'] = $request->query->get('returnLabel');
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('chill_crud_3party_3party_view', $params);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function onPostCheckACL($action, Request $request, $entity): ?Response
|
||||
{
|
||||
if ('edit' === $action || 'view' === $action) {
|
||||
|
@ -23,15 +23,15 @@
|
||||
{{ form_row(form.contactDataAnonymous) }}
|
||||
{% endif %}
|
||||
|
||||
{% if form.address is defined %}
|
||||
{{ form_row(form.address) }}
|
||||
{% endif %}
|
||||
|
||||
{% if form.activeChildren is defined %}
|
||||
<h2>{{ 'Contacts'|trans }}</h2>
|
||||
{{ form_widget(form.activeChildren) }}
|
||||
{% endif %}
|
||||
|
||||
{% if form.address is defined %}
|
||||
{{ form_row(form.address) }}
|
||||
{% endif %}
|
||||
|
||||
{{ form_row(form.comment) }}
|
||||
|
||||
{% if form.centers is defined %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user