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
7a10472a
Commit
7a10472a
authored
May 25, 2017
by
Munavijayalakshmi
Committed by
borisson_
May 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2880301
by Munavijayalakshmi: Convert module to use short array syntax (new coding standard)
parent
637550f4
Changes
43
Hide whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
440 additions
and
440 deletions
+440
-440
modules/core_search_facets/core_search_facets.module
modules/core_search_facets/core_search_facets.module
+2
-2
modules/core_search_facets/src/FacetsQuery.php
modules/core_search_facets/src/FacetsQuery.php
+2
-2
modules/core_search_facets/src/Plugin/Search/NodeSearchFacets.php
...core_search_facets/src/Plugin/Search/NodeSearchFacets.php
+32
-32
modules/core_search_facets/src/Plugin/facets/facet_source/CoreNodeSearchFacetSource.php
.../Plugin/facets/facet_source/CoreNodeSearchFacetSource.php
+10
-10
modules/facets_range_widget/src/Plugin/facets/processor/RangeSliderProcessor.php
...dget/src/Plugin/facets/processor/RangeSliderProcessor.php
+1
-1
modules/facets_summary/src/Entity/FacetsSummary.php
modules/facets_summary/src/Entity/FacetsSummary.php
+4
-4
modules/facets_summary/src/FacetsSummaryManager/DefaultFacetsSummaryManager.php
.../src/FacetsSummaryManager/DefaultFacetsSummaryManager.php
+4
-4
modules/facets_summary/src/Form/FacetsSummaryDeleteConfirmForm.php
...acets_summary/src/Form/FacetsSummaryDeleteConfirmForm.php
+2
-2
modules/facets_summary/src/Form/FacetsSummaryForm.php
modules/facets_summary/src/Form/FacetsSummaryForm.php
+53
-53
modules/facets_summary/src/Plugin/facets_summary/processor/ShowTextWhenEmptyProcessor.php
...n/facets_summary/processor/ShowTextWhenEmptyProcessor.php
+4
-4
modules/facets_summary/src/Processor/ProcessorPluginManager.php
...s/facets_summary/src/Processor/ProcessorPluginManager.php
+4
-4
modules/rest_facets/tests/src/Functional/RestIntegrationTest.php
.../rest_facets/tests/src/Functional/RestIntegrationTest.php
+5
-5
src/Controller/FacetController.php
src/Controller/FacetController.php
+1
-1
src/Entity/Facet.php
src/Entity/Facet.php
+3
-3
src/EventSubscriber.php
src/EventSubscriber.php
+1
-1
src/FacetListBuilder.php
src/FacetListBuilder.php
+107
-107
src/FacetSource/FacetSourceDeriverBase.php
src/FacetSource/FacetSourceDeriverBase.php
+1
-1
src/Form/FacetDeleteConfirmForm.php
src/Form/FacetDeleteConfirmForm.php
+2
-2
src/Form/FacetForm.php
src/Form/FacetForm.php
+91
-91
src/Form/FacetSourceEditForm.php
src/Form/FacetSourceEditForm.php
+2
-2
src/Plugin/facets/facet_source/SearchApiDisplay.php
src/Plugin/facets/facet_source/SearchApiDisplay.php
+2
-2
src/Plugin/facets/facet_source/SearchApiDisplayDeriver.php
src/Plugin/facets/facet_source/SearchApiDisplayDeriver.php
+1
-1
src/Plugin/facets/hierarchy/Taxonomy.php
src/Plugin/facets/hierarchy/Taxonomy.php
+2
-2
src/Plugin/facets/processor/CountLimitProcessor.php
src/Plugin/facets/processor/CountLimitProcessor.php
+6
-6
src/Plugin/facets/query_type/SearchApiRange.php
src/Plugin/facets/query_type/SearchApiRange.php
+1
-1
src/Plugin/facets/query_type/SearchApiString.php
src/Plugin/facets/query_type/SearchApiString.php
+3
-3
src/Plugin/facets/url_processor/QueryString.php
src/Plugin/facets/url_processor/QueryString.php
+1
-1
src/Plugin/facets/widget/DateArrayWidget.php
src/Plugin/facets/widget/DateArrayWidget.php
+2
-2
src/Plugin/facets/widget/DateBasicWidget.php
src/Plugin/facets/widget/DateBasicWidget.php
+2
-2
src/Processor/ProcessorPluginManager.php
src/Processor/ProcessorPluginManager.php
+10
-10
src/QueryType/QueryTypePluginBase.php
src/QueryType/QueryTypePluginBase.php
+1
-1
src/Utility/FacetsDateHandler.php
src/Utility/FacetsDateHandler.php
+3
-3
tests/src/Functional/ExampleContentTrait.php
tests/src/Functional/ExampleContentTrait.php
+14
-14
tests/src/Functional/FacetSourceTest.php
tests/src/Functional/FacetSourceTest.php
+6
-6
tests/src/Functional/FacetsTestBase.php
tests/src/Functional/FacetsTestBase.php
+5
-5
tests/src/Functional/HierarchicalFacetIntegrationTest.php
tests/src/Functional/HierarchicalFacetIntegrationTest.php
+17
-17
tests/src/Functional/TestHelperTrait.php
tests/src/Functional/TestHelperTrait.php
+1
-1
tests/src/FunctionalJavascript/WidgetJSTest.php
tests/src/FunctionalJavascript/WidgetJSTest.php
+14
-14
tests/src/Kernel/Entity/FacetFacetSourceTest.php
tests/src/Kernel/Entity/FacetFacetSourceTest.php
+2
-2
tests/src/Unit/Processor/ProcessorPluginManagerTest.php
tests/src/Unit/Processor/ProcessorPluginManagerTest.php
+4
-4
tests/src/Unit/QueryType/QueryTypePluginManagerTest.php
tests/src/Unit/QueryType/QueryTypePluginManagerTest.php
+4
-4
tests/src/Unit/UrlProcessor/UrlProcessorPluginManagerTest.php
...s/src/Unit/UrlProcessor/UrlProcessorPluginManagerTest.php
+4
-4
tests/src/Unit/Widget/WidgetPluginManagerTest.php
tests/src/Unit/Widget/WidgetPluginManagerTest.php
+4
-4
No files found.
modules/core_search_facets/core_search_facets.module
View file @
7a10472a
...
...
@@ -51,11 +51,11 @@ function core_search_facets_form_facet_source_edit_form_alter(&$form, FormStateI
$request
=
\
Drupal
::
requestStack
()
->
getMasterRequest
();
$facet_source_id
=
str_replace
(
":"
,
"__"
,
$request
->
attributes
->
get
(
'facets_facet_source'
));
if
(
strpos
(
$facet_source_id
,
'core_node_search'
)
!==
FALSE
)
{
$form
[
'advanced_filters'
]
=
array
(
$form
[
'advanced_filters'
]
=
[
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Show Advanced Filters.'
),
'#default_value'
=>
\
Drupal
::
config
(
"facets.facet_source.
{
$facet_source_id
}
"
)
->
get
(
'third_party_settings.core_search_facets.advanced_filters'
),
)
;
]
;
$form
[
'#entity_builders'
][]
=
'core_search_facets_facet_source_form_form_builder'
;
}
}
...
...
modules/core_search_facets/src/FacetsQuery.php
View file @
7a10472a
...
...
@@ -74,7 +74,7 @@ class FacetsQuery extends SearchQuery {
->
groupBy
(
'value'
)
->
groupBy
(
'i.type'
)
->
groupBy
(
'i.sid'
)
->
having
(
'COUNT(*) >= :matches'
,
array
(
':matches'
=>
$this
->
matches
)
);
->
having
(
'COUNT(*) >= :matches'
,
[
':matches'
=>
$this
->
matches
]
);
// For complex search queries, add the LIKE conditions.
/*if (!$this->simple) {
...
...
@@ -93,7 +93,7 @@ class FacetsQuery extends SearchQuery {
// Adds subquery to group the results in the r table.
$subquery
=
\
Drupal
::
database
()
->
select
(
$this
->
query
,
'r'
)
->
fields
(
'r'
,
array
(
'value'
)
)
->
fields
(
'r'
,
[
'value'
]
)
->
groupBy
(
'r.value'
);
// Adds COUNT() expression to get facet counts.
...
...
modules/core_search_facets/src/Plugin/Search/NodeSearchFacets.php
View file @
7a10472a
...
...
@@ -19,110 +19,110 @@ class NodeSearchFacets extends NodeSearch {
$keys
=
$this
->
getKeywords
();
$used_advanced
=
!
empty
(
$parameters
[
self
::
ADVANCED_FORM
]);
if
(
$used_advanced
)
{
$f
=
isset
(
$parameters
[
'f'
])
?
(
array
)
$parameters
[
'f'
]
:
array
()
;
$f
=
isset
(
$parameters
[
'f'
])
?
(
array
)
$parameters
[
'f'
]
:
[]
;
$defaults
=
$this
->
parseAdvancedDefaults
(
$f
,
$keys
);
}
else
{
$defaults
=
array
(
'keys'
=>
$keys
)
;
$defaults
=
[
'keys'
=>
$keys
]
;
}
$form
[
'basic'
][
'keys'
][
'#default_value'
]
=
$defaults
[
'keys'
];
// Add advanced search keyword-related boxes.
$form
[
'advanced'
]
=
array
(
$form
[
'advanced'
]
=
[
'#type'
=>
'details'
,
'#title'
=>
t
(
'Advanced search'
),
'#attributes'
=>
array
(
'class'
=>
array
(
'search-advanced'
))
,
'#attributes'
=>
[
'class'
=>
[
'search-advanced'
]]
,
'#access'
=>
$this
->
account
&&
$this
->
account
->
hasPermission
(
'use advanced search'
),
'#open'
=>
$used_advanced
,
)
;
]
;
$form
[
'advanced'
][
'keywords-fieldset'
]
=
array
(
$form
[
'advanced'
][
'keywords-fieldset'
]
=
[
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'Keywords'
),
)
;
]
;
$form
[
'advanced'
][
'keywords'
]
=
array
(
$form
[
'advanced'
][
'keywords'
]
=
[
'#prefix'
=>
'<div class="criterion">'
,
'#suffix'
=>
'</div>'
,
)
;
]
;
$form
[
'advanced'
][
'keywords-fieldset'
][
'keywords'
][
'or'
]
=
array
(
$form
[
'advanced'
][
'keywords-fieldset'
][
'keywords'
][
'or'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Containing any of the words'
),
'#size'
=>
30
,
'#maxlength'
=>
255
,
'#default_value'
=>
isset
(
$defaults
[
'or'
])
?
$defaults
[
'or'
]
:
''
,
)
;
]
;
$form
[
'advanced'
][
'keywords-fieldset'
][
'keywords'
][
'phrase'
]
=
array
(
$form
[
'advanced'
][
'keywords-fieldset'
][
'keywords'
][
'phrase'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Containing the phrase'
),
'#size'
=>
30
,
'#maxlength'
=>
255
,
'#default_value'
=>
isset
(
$defaults
[
'phrase'
])
?
$defaults
[
'phrase'
]
:
''
,
)
;
]
;
$form
[
'advanced'
][
'keywords-fieldset'
][
'keywords'
][
'negative'
]
=
array
(
$form
[
'advanced'
][
'keywords-fieldset'
][
'keywords'
][
'negative'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Containing none of the words'
),
'#size'
=>
30
,
'#maxlength'
=>
255
,
'#default_value'
=>
isset
(
$defaults
[
'negative'
])
?
$defaults
[
'negative'
]
:
''
,
)
;
]
;
$form
[
'advanced'
][
'submit'
]
=
array
(
$form
[
'advanced'
][
'submit'
]
=
[
'#type'
=>
'submit'
,
'#value'
=>
t
(
'Advanced search'
),
'#prefix'
=>
'<div class="action">'
,
'#suffix'
=>
'</div>'
,
'#weight'
=>
100
,
)
;
]
;
if
(
\
Drupal
::
config
(
"facets.facet_source.core_node_search__
{
$this
->
searchPageId
}
"
)
->
get
(
'third_party_settings.core_search_facets.advanced_filters'
))
{
// Add node types.
$types
=
array_map
(
array
(
'\Drupal\Component\Utility\Html'
,
'escape'
)
,
node_type_get_names
());
$form
[
'advanced'
][
'types-fieldset'
]
=
array
(
$types
=
array_map
(
[
'\Drupal\Component\Utility\Html'
,
'escape'
]
,
node_type_get_names
());
$form
[
'advanced'
][
'types-fieldset'
]
=
[
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'Types'
),
)
;
$form
[
'advanced'
][
'types-fieldset'
][
'type'
]
=
array
(
]
;
$form
[
'advanced'
][
'types-fieldset'
][
'type'
]
=
[
'#type'
=>
'checkboxes'
,
'#title'
=>
t
(
'Only of the type(s)'
),
'#prefix'
=>
'<div class="criterion">'
,
'#suffix'
=>
'</div>'
,
'#options'
=>
$types
,
'#default_value'
=>
isset
(
$defaults
[
'type'
])
?
$defaults
[
'type'
]
:
array
()
,
)
;
'#default_value'
=>
isset
(
$defaults
[
'type'
])
?
$defaults
[
'type'
]
:
[]
,
]
;
$form
[
'advanced'
][
'submit'
]
=
array
(
$form
[
'advanced'
][
'submit'
]
=
[
'#type'
=>
'submit'
,
'#value'
=>
t
(
'Advanced search'
),
'#prefix'
=>
'<div class="action">'
,
'#suffix'
=>
'</div>'
,
'#weight'
=>
100
,
)
;
]
;
// Add languages.
$language_options
=
array
()
;
$language_options
=
[]
;
$language_list
=
$this
->
languageManager
->
getLanguages
(
LanguageInterface
::
STATE_ALL
);
foreach
(
$language_list
as
$langcode
=>
$language
)
{
// Make locked languages appear special in the list.
$language_options
[
$langcode
]
=
$language
->
isLocked
()
?
t
(
'- @name -'
,
array
(
'@name'
=>
$language
->
getName
())
)
:
$language
->
getName
();
$language_options
[
$langcode
]
=
$language
->
isLocked
()
?
t
(
'- @name -'
,
[
'@name'
=>
$language
->
getName
()]
)
:
$language
->
getName
();
}
if
(
count
(
$language_options
)
>
1
)
{
$form
[
'advanced'
][
'lang-fieldset'
]
=
array
(
$form
[
'advanced'
][
'lang-fieldset'
]
=
[
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'Languages'
),
)
;
$form
[
'advanced'
][
'lang-fieldset'
][
'language'
]
=
array
(
]
;
$form
[
'advanced'
][
'lang-fieldset'
][
'language'
]
=
[
'#type'
=>
'checkboxes'
,
'#title'
=>
t
(
'Languages'
),
'#prefix'
=>
'<div class="criterion">'
,
'#suffix'
=>
'</div>'
,
'#options'
=>
$language_options
,
'#default_value'
=>
isset
(
$defaults
[
'language'
])
?
$defaults
[
'language'
]
:
array
()
,
)
;
'#default_value'
=>
isset
(
$defaults
[
'language'
])
?
$defaults
[
'language'
]
:
[]
,
]
;
}
}
}
...
...
modules/core_search_facets/src/Plugin/facets/facet_source/CoreNodeSearchFacetSource.php
View file @
7a10472a
...
...
@@ -143,10 +143,10 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea
*/
public
function
fillFacetsWithResults
(
array
$facets
)
{
foreach
(
$facets
as
$facet
)
{
$configuration
=
array
(
$configuration
=
[
'query'
=>
NULL
,
'facet'
=>
$facet
,
)
;
]
;
// Get the Facet Specific Query Type so we can process the results
// using the build() function of the query type.
...
...
@@ -240,7 +240,7 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea
$facet_fields
=
$this
->
getDefaultFields
();
// Get the allowed field types.
$allowed_field_types
=
$this
->
moduleHandler
->
invokeAll
(
'facets_core_allowed_field_types'
,
array
(
$field_types
=
[])
);
$allowed_field_types
=
$this
->
moduleHandler
->
invokeAll
(
'facets_core_allowed_field_types'
,
[
$field_types
=
[]]
);
// Get the current field instances and detect if the field type is allowed.
$fields
=
FieldConfig
::
loadMultiple
();
...
...
@@ -283,7 +283,7 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea
public
function
getFacetQueryExtender
()
{
if
(
!
$this
->
facetQueryExtender
)
{
$this
->
facetQueryExtender
=
$this
->
database
->
select
(
'search_index'
,
'i'
,
array
(
'target'
=>
'replica'
)
)
->
select
(
'search_index'
,
'i'
,
[
'target'
=>
'replica'
]
)
->
extend
(
'Drupal\core_search_facets\FacetsQuery'
);
$this
->
facetQueryExtender
->
join
(
'node_field_data'
,
'n'
,
'n.nid = i.sid AND n.langcode = i.langcode'
);
$this
->
facetQueryExtender
...
...
@@ -332,19 +332,19 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea
$column
=
$facet
->
getFieldIdentifier
()
.
'_value'
;
}
$query_info
[
'fields'
][
$field_name
.
'.'
.
$column
]
=
array
(
$query_info
[
'fields'
][
$field_name
.
'.'
.
$column
]
=
[
'table_alias'
=>
$table
,
'field'
=>
$column
,
)
;
]
;
// Adds the join on the node table.
$query_info
[
'joins'
]
=
array
(
$table
=>
array
(
$query_info
[
'joins'
]
=
[
$table
=>
[
'table'
=>
$table
,
'alias'
=>
$table
,
'condition'
=>
"n.vid =
$table
.revision_id AND i.langcode =
$table
.langcode"
,
)
,
)
;
]
,
]
;
}
// Returns query info, makes sure all keys are present.
...
...
modules/facets_range_widget/src/Plugin/facets/processor/RangeSliderProcessor.php
View file @
7a10472a
...
...
@@ -30,7 +30,7 @@ class RangeSliderProcessor extends SliderProcessor implements PreQueryProcessorI
array_walk
(
$active_items
,
function
(
&
$item
)
{
if
(
preg_match
(
'/\(min:((?:-)?[\d\.]+),max:((?:-)?[\d\.]+)\)/i'
,
$item
,
$matches
))
{
$item
=
array
(
$matches
[
1
],
$matches
[
2
])
;
$item
=
[
$matches
[
1
],
$matches
[
2
]]
;
}
else
{
$item
=
NULL
;
...
...
modules/facets_summary/src/Entity/FacetsSummary.php
View file @
7a10472a
...
...
@@ -193,10 +193,10 @@ class FacetsSummary extends ConfigEntityBase implements FacetsSummaryInterface {
}
elseif
(
!
class_exists
(
$processor_definition
[
'class'
]))
{
\
Drupal
::
logger
(
'facets_summary'
)
->
warning
(
'Processor @id specifies a non-existing @class.'
,
array
(
->
warning
(
'Processor @id specifies a non-existing @class.'
,
[
'@id'
=>
$name
,
'@class'
=>
$processor_definition
[
'class'
],
)
);
]
);
}
}
}
...
...
@@ -232,7 +232,7 @@ class FacetsSummary extends ConfigEntityBase implements FacetsSummaryInterface {
public
function
getProcessorsByStage
(
$stage
,
$only_enabled
=
TRUE
)
{
$processors
=
$this
->
getProcessors
(
$only_enabled
);
$processor_settings
=
$this
->
getProcessorConfigs
();
$processor_weights
=
array
()
;
$processor_weights
=
[]
;
// Get a list of all processors for given stage.
foreach
(
$processors
as
$name
=>
$processor
)
{
...
...
@@ -249,7 +249,7 @@ class FacetsSummary extends ConfigEntityBase implements FacetsSummaryInterface {
// Sort requested processors by weight.
asort
(
$processor_weights
);
$return_processors
=
array
()
;
$return_processors
=
[]
;
foreach
(
$processor_weights
as
$name
=>
$weight
)
{
$return_processors
[
$name
]
=
$processors
[
$name
];
}
...
...
modules/facets_summary/src/FacetsSummaryManager/DefaultFacetsSummaryManager.php
View file @
7a10472a
...
...
@@ -108,12 +108,12 @@ class DefaultFacetsSummaryManager {
$this
->
facetManager
->
build
(
$facet
);
}
$build
=
array
(
$build
=
[
'#theme'
=>
'facets_summary_item_list'
,
'#attributes'
=>
array
(
'#attributes'
=>
[
'data-drupal-facets-summary-id'
=>
$facets_summary
->
id
(),
)
,
)
;
]
,
]
;
$results
=
[];
...
...
modules/facets_summary/src/Form/FacetsSummaryDeleteConfirmForm.php
View file @
7a10472a
...
...
@@ -15,7 +15,7 @@ class FacetsSummaryDeleteConfirmForm extends EntityConfirmFormBase {
* {@inheritdoc}
*/
public
function
getQuestion
()
{
return
$this
->
t
(
'Are you sure you want to delete the facet summary %name?'
,
array
(
'%name'
=>
$this
->
entity
->
label
())
);
return
$this
->
t
(
'Are you sure you want to delete the facet summary %name?'
,
[
'%name'
=>
$this
->
entity
->
label
()]
);
}
/**
...
...
@@ -44,7 +44,7 @@ class FacetsSummaryDeleteConfirmForm extends EntityConfirmFormBase {
*/
public
function
submitForm
(
array
&
$form
,
FormStateInterface
$form_state
)
{
$this
->
entity
->
delete
();
drupal_set_message
(
$this
->
t
(
'The facet summary %name has been deleted.'
,
array
(
'%name'
=>
$this
->
entity
->
label
())
));
drupal_set_message
(
$this
->
t
(
'The facet summary %name has been deleted.'
,
[
'%name'
=>
$this
->
entity
->
label
()]
));
$form_state
->
setRedirect
(
'facets.overview'
);
}
...
...
modules/facets_summary/src/Form/FacetsSummaryForm.php
View file @
7a10472a
...
...
@@ -117,7 +117,7 @@ class FacetsSummaryForm extends EntityForm {
$form
[
'#tree'
]
=
TRUE
;
$form
[
'#attached'
][
'library'
][]
=
'facets/drupal.facets.index-active-formatters'
;
$form
[
'#title'
]
=
$this
->
t
(
'Edit %label facets summary'
,
array
(
'%label'
=>
$facets_summary
->
label
())
);
$form
[
'#title'
]
=
$this
->
t
(
'Edit %label facets summary'
,
[
'%label'
=>
$facets_summary
->
label
()]
);
$form
[
'facets'
]
=
[
'#type'
=>
'table'
,
...
...
@@ -200,68 +200,68 @@ class FacetsSummaryForm extends EntityForm {
$enabled_processors
=
$facets_summary
->
getProcessors
(
TRUE
);
$stages
=
$this
->
processorPluginManager
->
getProcessingStages
();
$processors_by_stage
=
array
()
;
$processors_by_stage
=
[]
;
foreach
(
$stages
as
$stage
=>
$definition
)
{
$processors_by_stage
[
$stage
]
=
$facets_summary
->
getProcessorsByStage
(
$stage
,
FALSE
);
}
// Add the list of all other processors with checkboxes to enable/disable
// them.
$form
[
'facets_summary_settings'
]
=
array
(
$form
[
'facets_summary_settings'
]
=
[
'#type'
=>
'fieldset'
,
'#title'
=>
$this
->
t
(
'Facets Summary settings'
),
'#attributes'
=>
array
(
'class'
=>
array
(
'#attributes'
=>
[
'class'
=>
[
'search-api-status-wrapper'
,
)
,
)
,
)
;
]
,
]
,
]
;
foreach
(
$all_processors
as
$processor_id
=>
$processor
)
{
$clean_css_id
=
Html
::
cleanCssIdentifier
(
$processor_id
);
$form
[
'facets_summary_settings'
][
$processor_id
][
'status'
]
=
array
(
$form
[
'facets_summary_settings'
][
$processor_id
][
'status'
]
=
[
'#type'
=>
'checkbox'
,
'#title'
=>
(
string
)
$processor
->
getPluginDefinition
()[
'label'
],
'#default_value'
=>
!
empty
(
$enabled_processors
[
$processor_id
]),
'#description'
=>
$processor
->
getDescription
(),
'#attributes'
=>
array
(
'class'
=>
array
(
'#attributes'
=>
[
'class'
=>
[
'search-api-processor-status-'
.
$clean_css_id
,
)
,
]
,
'data-id'
=>
$clean_css_id
,
)
,
)
;
]
,
]
;
$form
[
'facets_summary_settings'
][
$processor_id
][
'settings'
]
=
[];
$processor_form_state
=
SubformState
::
createForSubform
(
$form
[
'facets_summary_settings'
][
$processor_id
][
'settings'
],
$form
,
$form_state
);
$processor_form
=
$processor
->
buildConfigurationForm
(
$form
,
$processor_form_state
,
$facets_summary
);
if
(
$processor_form
)
{
$form
[
'facets_summary_settings'
][
$processor_id
][
'settings'
]
=
array
(
$form
[
'facets_summary_settings'
][
$processor_id
][
'settings'
]
=
[
'#type'
=>
'details'
,
'#title'
=>
$this
->
t
(
'%processor settings'
,
[
'%processor'
=>
(
string
)
$processor
->
getPluginDefinition
()[
'label'
]]),
'#open'
=>
TRUE
,
'#attributes'
=>
array
(
'class'
=>
array
(
'#attributes'
=>
[
'class'
=>
[
'facets-processor-settings-'
.
Html
::
cleanCssIdentifier
(
$processor_id
),
'facets-processor-settings-facet'
,
'facets-processor-settings'
,
)
,
)
,
'#states'
=>
array
(
'visible'
=>
array
(
':input[name="facets_summary_settings['
.
$processor_id
.
'][status]"]'
=>
array
(
'checked'
=>
TRUE
)
,
)
,
)
,
)
;
]
,
]
,
'#states'
=>
[
'visible'
=>
[
':input[name="facets_summary_settings['
.
$processor_id
.
'][status]"]'
=>
[
'checked'
=>
TRUE
]
,
]
,
]
,
]
;
$form
[
'facets_summary_settings'
][
$processor_id
][
'settings'
]
+=
$processor_form
;
}
}
$form
[
'weights'
]
=
array
(
$form
[
'weights'
]
=
[
'#type'
=>
'details'
,
'#title'
=>
$this
->
t
(
'Advanced settings'
),
'#collapsible'
=>
TRUE
,
'#collapsed'
=>
TRUE
,
)
;
]
;
$form
[
'weights'
][
'order'
]
=
[
'#prefix'
=>
'<h3>'
,
...
...
@@ -272,24 +272,24 @@ class FacetsSummaryForm extends EntityForm {
// Order enabled processors per stage, create all the containers for the
// different stages.
foreach
(
$stages
as
$stage
=>
$description
)
{
$form
[
'weights'
][
$stage
]
=
array
(
$form
[
'weights'
][
$stage
]
=
[
'#type'
=>
'fieldset'
,
'#title'
=>
$description
[
'label'
],
'#attributes'
=>
array
(
'class'
=>
array
(
'#attributes'
=>
[
'class'
=>
[
'search-api-stage-wrapper'
,
'search-api-stage-wrapper-'
.
Html
::
cleanCssIdentifier
(
$stage
),
)
,
)
,
)
;
$form
[
'weights'
][
$stage
][
'order'
]
=
array
(
]
,
]
,
]
;
$form
[
'weights'
][
$stage
][
'order'
]
=
[
'#type'
=>
'table'
,
)
;
$form
[
'weights'
][
$stage
][
'order'
][
'#tabledrag'
][]
=
array
(
]
;
$form
[
'weights'
][
$stage
][
'order'
][
'#tabledrag'
][]
=
[
'action'
=>
'order'
,
'relationship'
=>
'sibling'
,
'group'
=>
'search-api-processor-weight-'
.
Html
::
cleanCssIdentifier
(
$stage
),
)
;
]
;
}
$processor_settings
=
$facets_summary
->
getProcessorConfigs
();
...
...
@@ -303,38 +303,38 @@ class FacetsSummaryForm extends EntityForm {
?
$processor_settings
[
$processor_id
][
'weights'
][
$stage
]
:
$processor
->
getDefaultWeight
(
$stage
);
if
(
$processor
->
isHidden
())
{
$form
[
'processors'
][
$processor_id
][
'weights'
][
$stage
]
=
array
(
$form
[
'processors'
][
$processor_id
][
'weights'
][
$stage
]
=
[
'#type'
=>
'value'
,
'#value'
=>
$weight
,
)
;
]
;
continue
;
}
$form
[
'weights'
][
$stage
][
'order'
][
$processor_id
][
'#attributes'
][
'class'
][]
=
'draggable'
;
$form
[
'weights'
][
$stage
][
'order'
][
$processor_id
][
'#attributes'
][
'class'
][]
=
'search-api-processor-weight--'
.
Html
::
cleanCssIdentifier
(
$processor_id
);
$form
[
'weights'
][
$stage
][
'order'
][
$processor_id
][
'#weight'
]
=
$weight
;
$form
[
'weights'
][
$stage
][
'order'
][
$processor_id
][
'label'
][
'#plain_text'
]
=
(
string
)
$processor
->
getPluginDefinition
()[
'label'
];
$form
[
'weights'
][
$stage
][
'order'
][
$processor_id
][
'weight'
]
=
array
(
$form
[
'weights'
][
$stage
][
'order'
][
$processor_id
][
'weight'
]
=
[
'#type'
=>
'weight'
,
'#title'
=>
$this
->
t
(
'Weight for processor %title'
,
array
(
'%title'
=>
(
string
)
$processor
->
getPluginDefinition
()[
'label'
])
),
'#title'
=>
$this
->
t
(
'Weight for processor %title'
,
[
'%title'
=>
(
string
)
$processor
->
getPluginDefinition
()[
'label'
]]
),
'#title_display'
=>
'invisible'
,
'#default_value'
=>
$weight
,
'#parents'
=>
array
(
'processors'
,
$processor_id
,
'weights'
,
$stage
)
,
'#attributes'
=>
array
(
'class'
=>
array
(
'#parents'
=>
[
'processors'
,
$processor_id
,
'weights'
,
$stage
]
,
'#attributes'
=>
[
'class'
=>
[
'search-api-processor-weight-'
.
Html
::
cleanCssIdentifier
(
$stage
),
)
,
)
,
)
;
]
,
]
,
]
;
}
}
// Add vertical tabs containing the settings for the processors. Tabs for
// disabled processors are hidden with JS magic, but need to be included in
// case the processor is enabled.
$form
[
'processor_settings'
]
=
array
(
$form
[
'processor_settings'
]
=
[
'#title'
=>
$this
->
t
(
'Processor settings'
),
'#type'
=>
'vertical_tabs'
,
)
;
]
;
return
$form
;
}
...
...
@@ -383,11 +383,11 @@ class FacetsSummaryForm extends EntityForm {
continue
;
}
$new_settings
=
array
(
$new_settings
=
[
'processor_id'
=>
$processor_id
,
'weights'
=>
array
()
,
'settings'
=>
array
()
,
)
;
'weights'
=>
[]
,
'settings'
=>
[]
,
]
;
if
(
!
empty
(
$values
[
'processors'
][
$processor_id
][
'weights'
]))
{
$new_settings
[
'weights'
]
=
$values
[
'processors'
][
$processor_id
][
'weights'
];
...
...
modules/facets_summary/src/Plugin/facets_summary/processor/ShowTextWhenEmptyProcessor.php
View file @
7a10472a
...
...
@@ -65,12 +65,12 @@ class ShowTextWhenEmptyProcessor extends ProcessorPluginBase implements BuildPro
* {@inheritdoc}
*/
public
function
defaultConfiguration
()
{
return
array
(
'text'
=>
array
(
return
[
'text'
=>
[
'format'
=>
'plain_text'
,
'value'
=>
$this
->
t
(
'There is no current search in progress.'
),
)
,
)
;
]
,
]
;
}
/**
...
...
modules/facets_summary/src/Processor/ProcessorPluginManager.php
View file @
7a10472a
...
...
@@ -42,11 +42,11 @@ class ProcessorPluginManager extends DefaultPluginManager {
* - label: The translated label for this stage.
*/
public
function
getProcessingStages
()
{
return
array
(
ProcessorInterface
::
STAGE_BUILD
=>
array
(
return
[
ProcessorInterface
::
STAGE_BUILD
=>
[
'label'
=>
$this
->
t
(
'Build stage'
),
)
,
)
;
]
,
]
;
}
}
modules/rest_facets/tests/src/Functional/RestIntegrationTest.php
View file @
7a10472a
...
...
@@ -45,11 +45,11 @@ class RestIntegrationTest extends FacetsTestBase {
// and thus removed from the test index. (We can't do it in setUp(), before
// calling the parent method, since the container isn't set up at that
// point.)
$bundles
=
array
(
'entity_test_mulrev_changed'
=>
array
(
'label'
=>
'Entity Test Bundle'
)
,
'item'
=>
array
(
'label'
=>
'item'
)
,
'article'
=>
array
(
'label'
=>
'article'
)
,
)
;
$bundles
=
[
'entity_test_mulrev_changed'
=>
[
'label'
=>
'Entity Test Bundle'
]
,
'item'
=>
[
'label'
=>
'item'
]
,
'article'
=>
[
'label'
=>
'article'
]
,
]
;
\
Drupal
::
state
()
->
set
(
'entity_test_mulrev_changed.bundles'
,
$bundles
);
parent
::
installModulesFromClassProperty
(
$container
);
...
...
src/Controller/FacetController.php
View file @
7a10472a
...
...
@@ -35,7 +35,7 @@ class FacetController extends ControllerBase {
* The page title.
*/
public
function
pageTitle
(
FacetInterface
$facet
)
{
return
new
FormattableMarkup
(
'@title'
,
array
(
'@title'
=>
$facet
->
label
())
);
return
new
FormattableMarkup
(
'@title'
,
[
'@title'
=>
$facet
->
label
()]
);
}
}
src/Entity/Facet.php
View file @
7a10472a
...
...
@@ -422,10 +422,10 @@ class Facet extends ConfigEntityBase implements FacetInterface {
}
elseif
(
!
class_exists
(
$processor_definition
[
'class'
]))
{
\
Drupal
::
logger
(
'facets'
)
->
warning
(
'Processor @id specifies a non-existing @class.'
,
array
(