Skip to content

Commit

Permalink
EZP-32395: Sort out Locations tab info on visibility (#1725)
Browse files Browse the repository at this point in the history
* EZP-32395: Sort out Locations tab info on visibility

* EZP-32395: BC remark

Co-authored-by: Bartek Wajda <bartlomiej.wajda@ibexa.co>
  • Loading branch information
Bartek and barw4 committed Mar 26, 2021
1 parent 3e6a29e commit e1c20e3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
19 changes: 0 additions & 19 deletions src/bundle/Controller/ContentViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ public function locationViewAction(Request $request, ContentView $view): Content
$this->supplyPathLocations($view);
$this->subitemsContentViewParameterSupplier->supply($view);
$this->supplyContentActionForms($view);
$this->supplyIsLocationInvisible($view);
$this->supplyContentReverseRelations($view);
$this->supplyContentTreeParameters($view);
}
Expand Down Expand Up @@ -567,22 +566,4 @@ function (Repository $repository) use ($contentInfo) {

$view->addParameters(['content_has_reverse_relations' => \count($relations) > 0]);
}

/**
* @param \eZ\Publish\Core\MVC\Symfony\View\ContentView $view
*/
private function supplyIsLocationInvisible(ContentView $view)
{
$location = $view->getLocation();
$parentLocation = $this->permissionResolver->sudo(
function (Repository $repository) use ($location) {
return $repository->getLocationService()->loadLocation($location->parentLocationId);
},
$this->repository
);
$isLocationVisible = !($parentLocation->hidden || $parentLocation->invisible);

// Location is invisible when parent location is not visible.
$view->addParameters(['is_location_visible' => $isLocationVisible]);
}
}
3 changes: 2 additions & 1 deletion src/bundle/Resources/views/content/locationview.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
</div>
<div class="panel panel-primary">
<div class="panel-body">
{# 'is_location_visible': location.invisible - param deprecated since EZP-32395 #}
{{ ez_platform_tabs('location-view', {
'content': content,
'location': location,
Expand All @@ -73,7 +74,7 @@
'system_urls_pagination_params': system_urls_pagination_params,
'roles_pagination_params': roles_pagination_params,
'policies_pagination_params': policies_pagination_params,
'is_location_visible': is_location_visible,
'is_location_visible': location.invisible,
}, '@ezdesign/parts/tab/locationview.html.twig') }}

{% if contentType.isContainer %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
{% if not can_hide[location.id] %} disabled="disabled"{% endif %}
value="{{ location.id }}"/>
</label>
{% if location.contentInfo.isHidden or not is_location_visible %}
{% if location.invisible %}
<span class="ml-2">
{{ 'tab.locations.hidden_content_or_superior'|trans()|desc('Content or superior is hidden') }}
</span>
Expand Down

0 comments on commit e1c20e3

Please sign in to comment.