Skip to content

Commit

Permalink
Adjustments.
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-vessey committed Apr 10, 2024
1 parent f89a4c9 commit 3d11969
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/EmbargoStorageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ trait EmbargoStorageTrait {
/**
* The current request.
*
* @var \Symfony\Component\HttpFoundation\Request
* @var \Symfony\Component\HttpFoundation\Request|null
*/
protected Request $request;
protected ?Request $request;

/**
* The current user.
Expand Down Expand Up @@ -95,13 +95,13 @@ protected function setUser(AccountInterface $user) : self {
/**
* The request visible to the trait.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param \Symfony\Component\HttpFoundation\Request|null $request
* The request with which to evaluate.
*
* @return \Drupal\embargo\EmbargoStorageInterface|\Drupal\embargo\EmbargoStorageTrait
* Fluent interface; the current object.
*/
protected function setRequest(Request $request) : self {
protected function setRequest(?Request $request) : self {
$this->request = $request;
return $this;
}
Expand Down
4 changes: 2 additions & 2 deletions src/EventSubscriber/EmbargoJoinProcessorEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ public function preQuery(PreQueryEvent $event) : void {
]),
[
'!join' => $helper->join(
$get_field_name(NULL, $info['path']),
$get_field_name('entity:embargo', 'embargoed_node:entity:nid'),
$get_field_name(NULL, $info['embargo path']),
$get_field_name(NULL, $info['node path']),
),
'!type_field' => $get_field_name('entity:embargo', 'expiration_type'),
'!exempt_user_field' => $get_field_name('entity:embargo', 'exempt_users:entity:uid'),
Expand Down
10 changes: 6 additions & 4 deletions src/Plugin/search_api/processor/EmbargoJoinProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
* @SearchApiProcessor(
* id = "embargo_join_processor",
* label = @Translation("Embargo access, join-wise"),
* description = @Translation("Add information regarding embargo access
* constraints."), stages = {
* description = @Translation("Add information regarding embargo access constraints."),
* stages = {
* "add_properties" = 20,
* "pre_index_save" = 20,
* "preprocess_query" = 20,
Expand Down Expand Up @@ -252,13 +252,15 @@ public function preprocessSearchQuery(QueryInterface $query) : void {
if (in_array('entity:node', $this->index->getDatasourceIds())) {
$queries['node'] = [
'data sources' => ['entity:node'],
'path' => 'embargo_node__node',
'embargo path' => 'embargo_node__node',
'node path' => 'embargo_node',
];
}
if ($intersection = array_intersect($this->index->getDatasourceIds(), ['entity:media', 'entity:file'])) {
$queries['file'] = [
'data sources' => $intersection,
'path' => 'embargo_node__file',
'embargo path' => 'embargo_node__file',
'node path' => 'embargo_node',
];
}

Expand Down
5 changes: 2 additions & 3 deletions src/Plugin/search_api/processor/EmbargoProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
*
* @SearchApiProcessor(
* id = "embargo_processor",
* label = @Translation("Embargo access"),
* description = @Translation("Add information regarding embargo access
* constraints."),
* label = @Translation("Embargo access (deprecated)"),
* description = @Translation("Add information regarding embargo access constraints."),
* stages = {
* "add_properties" = 20,
* "pre_index_save" = 20,
Expand Down

0 comments on commit 3d11969

Please sign in to comment.