Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
entity_language_fallback
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
entity_language_fallback
Commits
dbfcbf0a
Commit
dbfcbf0a
authored
1 year ago
by
Jens Beltofte
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3203188
by yoerioptr, beltofte: Search API compatibility
parent
b4e34835
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Plugin/search_api/datasource/ContentEntityFallback.php
+33
-0
33 additions, 0 deletions
src/Plugin/search_api/datasource/ContentEntityFallback.php
with
33 additions
and
0 deletions
src/Plugin/search_api/datasource/ContentEntityFallback.php
+
33
−
0
View file @
dbfcbf0a
...
...
@@ -6,7 +6,9 @@ use Drupal\Core\Entity\ContentEntityInterface;
use
Drupal\entity_language_fallback
\FallbackControllerInterface
;
use
Drupal\language\Entity\ConfigurableLanguage
;
use
Drupal\search_api
\Entity\Index
;
use
Drupal\search_api
\IndexInterface
;
use
Drupal\search_api\Plugin\search_api
\datasource\ContentEntity
;
use
Drupal\search_api\Plugin\search_api
\datasource\ContentEntityTrackingManager
;
use
Drupal\search_api
\Utility\Utility
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
...
...
@@ -187,4 +189,35 @@ class ContentEntityFallback extends ContentEntity {
$this
->
fallbackController
=
$controller
;
}
/**
* Filters a set of datasource-specific item IDs.
*
* Returns only those item IDs that are valid for the given datasource and
* index. This method only checks the item language, though – whether an
* entity with that ID actually exists, or whether it has a bundle included
* for that datasource, is not verified.
*
* Note: ContentEntity::filterValidItemIds() is deprecated in Search API
* and the "wrapper"-method is only implemented here as a backwards
* compatability solution.
*
* @param \Drupal\search_api\IndexInterface $index
* The index for which to validate.
* @param string $datasource_id
* The ID of the datasource on the index for which to validate.
* @param string[] $item_ids
* The item IDs to be validated.
*
* @return string[]
* All given item IDs that are valid for that index and datasource.
*/
public
static
function
filterValidItemIds
(
IndexInterface
$index
,
$datasource_id
,
array
$item_ids
)
{
if
(
method_exists
(
ContentEntityTrackingManager
::
class
,
'filterValidItemIds'
))
{
return
ContentEntityTrackingManager
::
filterValidItemIds
(
$index
,
$datasource_id
,
$item_ids
);
}
else
{
return
ContentEntity
::
filterValidItemIds
(
$index
,
$datasource_id
,
$item_ids
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment