Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
F
facets
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
7
Merge Requests
7
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
facets
Commits
9e01591c
Commit
9e01591c
authored
Jun 27, 2017
by
borisson_
Committed by
borisson_
Jun 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2877989
by borisson_: Module depends on a search api service and it shouldn't
parent
b71005a2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
2 deletions
+28
-2
modules/facets_summary/tests/src/Functional/HierarchicalFacetIntegrationTest.php
...tests/src/Functional/HierarchicalFacetIntegrationTest.php
+1
-1
src/FacetSource/FacetSourcePluginManager.php
src/FacetSource/FacetSourcePluginManager.php
+19
-0
src/Plugin/facets/facet_source/SearchApiDisplay.php
src/Plugin/facets/facet_source/SearchApiDisplay.php
+7
-0
tests/src/Functional/HierarchicalFacetIntegrationTest.php
tests/src/Functional/HierarchicalFacetIntegrationTest.php
+1
-1
No files found.
modules/facets_summary/tests/src/Functional/HierarchicalFacetIntegrationTest.php
View file @
9e01591c
...
...
@@ -6,7 +6,7 @@ use Drupal\Component\Utility\Unicode;
use
Drupal\Core\Language\LanguageInterface
;
use
Drupal\search_api
\
Item\Field
;
use
Drupal\taxonomy\Entity\Term
;
use
Drupal\
taxonomy\Tests
\TaxonomyTestTrait
;
use
Drupal\
Tests\taxonomy\Functional
\TaxonomyTestTrait
;
use
Drupal\field\Tests\EntityReference\EntityReferenceTestTrait
;
use
Drupal\Tests\facets\Functional\FacetsTestBase
;
...
...
src/FacetSource/FacetSourcePluginManager.php
View file @
9e01591c
...
...
@@ -49,4 +49,23 @@ class FacetSourcePluginManager extends DefaultPluginManager {
}
}
/**
* {@inheritdoc}
*/
protected
function
findDefinitions
()
{
$defs
=
parent
::
findDefinitions
();
// Definitions that are based on search api when search api is not enabled
// should not exist, so make sure we do exactly that, we do this in
// ::findDefinitions because this one is called before the result is saved.
$defs
=
array_filter
(
$defs
,
function
(
$item
)
{
if
(
$item
[
'id'
]
===
'search_api'
&&
!
$this
->
moduleHandler
->
moduleExists
(
'search_api'
))
{
return
FALSE
;
}
return
TRUE
;
});
return
$defs
;
}
}
src/Plugin/facets/facet_source/SearchApiDisplay.php
View file @
9e01591c
...
...
@@ -87,6 +87,13 @@ class SearchApiDisplay extends FacetSourcePluginBase implements SearchApiFacetSo
* {@inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
,
array
$configuration
,
$plugin_id
,
$plugin_definition
)
{
// If the Search API module is not enabled, we should just return an empty
// object. This allows us to have this class in the module without having a
// dependency on the Search API module.
if
(
!
$container
->
get
(
'module_handler'
)
->
moduleExists
(
'search_api'
))
{
return
new
\
stdClass
();
}
return
new
static
(
$configuration
,
$plugin_id
,
...
...
tests/src/Functional/HierarchicalFacetIntegrationTest.php
View file @
9e01591c
...
...
@@ -6,8 +6,8 @@ use Drupal\Component\Utility\Unicode;
use
Drupal\Core\Language\LanguageInterface
;
use
Drupal\search_api
\
Item\Field
;
use
Drupal\taxonomy\Entity\Term
;
use
Drupal\taxonomy\Tests\TaxonomyTestTrait
;
use
Drupal\field\Tests\EntityReference\EntityReferenceTestTrait
;
use
Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait
;
/**
* Tests the hierarchical facets implementation.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment