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
c71acc1b
Commit
c71acc1b
authored
Oct 02, 2017
by
StryKaizer
Committed by
borisson_
Oct 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2913244
by borisson_, StryKaizer: Disable boolean processor on non-boolean facets
parent
583eaef6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
src/Plugin/facets/processor/BooleanItemProcessor.php
src/Plugin/facets/processor/BooleanItemProcessor.php
+14
-0
tests/src/Functional/ProcessorIntegrationTest.php
tests/src/Functional/ProcessorIntegrationTest.php
+11
-0
No files found.
src/Plugin/facets/processor/BooleanItemProcessor.php
View file @
c71acc1b
...
...
@@ -2,6 +2,7 @@
namespace
Drupal\facets\Plugin\facets\processor
;
use
Drupal\Core\TypedData\DataDefinitionInterface
;
use
Drupal\facets\FacetInterface
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\facets\Processor\BuildProcessorInterface
;
...
...
@@ -84,4 +85,17 @@ class BooleanItemProcessor extends ProcessorPluginBase implements BuildProcessor
];
}
/**
* {@inheritdoc}
*/
public
function
supportsFacet
(
FacetInterface
$facet
)
{
$data_definition
=
$facet
->
getDataDefinition
();
$property_definitions
=
$data_definition
->
getPropertyDefinitions
();
foreach
(
$property_definitions
as
$k
=>
$definition
)
{
if
(
$definition
->
getDataType
()
==
"boolean"
)
{
return
TRUE
;
}};
return
FALSE
;
}
}
tests/src/Functional/ProcessorIntegrationTest.php
View file @
c71acc1b
...
...
@@ -703,4 +703,15 @@ class ProcessorIntegrationTest extends FacetsTestBase {
$this
->
assertNoFacetBlocksAppear
();
}
/**
* Tests that processors are hidden when the correct fields aren't there.
*/
public
function
testHiddenProcessors
()
{
$facet_id
=
'alpaca'
;
$this
->
editForm
=
'admin/config/search/facets/'
.
$facet_id
.
'/edit'
;
$this
->
createFacet
(
'Alpaca'
,
$facet_id
);
$this
->
drupalGet
(
$this
->
editForm
);
$this
->
assertSession
()
->
pageTextNotContains
(
'Boolean item label'
);
}
}
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