Skip to content

Commit

Permalink
Issue netgen-layouts#7: Remove CJW stack comments and fix error if $t…
Browse files Browse the repository at this point in the history
…his->contentProvider->provideLocation() doesnt return a location
  • Loading branch information
tinomaass committed Apr 25, 2024
1 parent cc5ad92 commit ad41270
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 31 deletions.
14 changes: 0 additions & 14 deletions CHANGELOG_CJW

This file was deleted.

4 changes: 0 additions & 4 deletions bundle/Resources/translations/nglayouts.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ block.ibexa_content_field.field_identifier: 'Field identifier'
block.ibexa_component.content: 'Content'

query.ibexa_content_search.use_current_location: 'Use current location as parent'

# CJW Stack
query.ibexa_content_search.use_parent_location: 'Use parent location as parent'
# -- CJW Stack

query.ibexa_content_search.parent_location_id: 'Parent location'
query.ibexa_content_search.sort_direction: 'Sort direction'
query.ibexa_content_search.sort_type: 'Sort type'
Expand Down
4 changes: 0 additions & 4 deletions lib/Collection/QueryType/Handler/ContentSearchHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,7 @@ public function getCount(Query $query): int

public function isContextual(Query $query): bool
{
// CJW Stack
return $query->getParameter('use_current_location')->getValue() === true || $query->getParameter('use_parent_location')->getValue() === true;
// -- CJW Stack

//return $query->getParameter('use_current_location')->getValue() === true;
}

/**
Expand Down
16 changes: 7 additions & 9 deletions lib/Collection/QueryType/Handler/Traits/ParentLocationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ private function setLocationService(LocationService $locationService): void
*/
private function buildParentLocationParameters(ParameterBuilderInterface $builder, array $groups = []): void
{
//
// CJW Stack
//

$builder->add(
'use_parent_location',
ParameterType\Compound\BooleanType::class,
Expand All @@ -54,8 +50,6 @@ private function buildParentLocationParameters(ParameterBuilderInterface $builde
],
);

// -- CJW Stack

$builder->add(
'use_current_location',
ParameterType\Compound\BooleanType::class,
Expand Down Expand Up @@ -83,12 +77,16 @@ private function getParentLocation(ParameterCollectionInterface $parameterCollec
if ($parameterCollection->getParameter('use_current_location')->getValue() === true) {
return $this->contentProvider->provideLocation();
}
// CJW Stack
elseif ( $parameterCollection->getParameter('use_parent_location')->getValue() === true )
{
return $this->contentProvider->provideLocation()->getParentLocation();
$currentLocation = $this->contentProvider->provideLocation();

if ( $currentLocation instanceof Location )
{
return $currentLocation->getParentLocation();
}

}
// -- CJW Stack

$parentLocationId = $parameterCollection->getParameter('parent_location_id')->getValue();
if ($parentLocationId === null) {
Expand Down

0 comments on commit ad41270

Please sign in to comment.