mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +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
|
protected function onPostCheckACL($action, Request $request, $entity): ?Response
|
||||||
{
|
{
|
||||||
if ('edit' === $action || 'view' === $action) {
|
if ('edit' === $action || 'view' === $action) {
|
||||||
|
@ -23,15 +23,15 @@
|
|||||||
{{ form_row(form.contactDataAnonymous) }}
|
{{ form_row(form.contactDataAnonymous) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if form.address is defined %}
|
||||||
|
{{ form_row(form.address) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if form.activeChildren is defined %}
|
{% if form.activeChildren is defined %}
|
||||||
<h2>{{ 'Contacts'|trans }}</h2>
|
<h2>{{ 'Contacts'|trans }}</h2>
|
||||||
{{ form_widget(form.activeChildren) }}
|
{{ form_widget(form.activeChildren) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if form.address is defined %}
|
|
||||||
{{ form_row(form.address) }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{{ form_row(form.comment) }}
|
{{ form_row(form.comment) }}
|
||||||
|
|
||||||
{% if form.centers is defined %}
|
{% if form.centers is defined %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user