Commit a23387db authored by borisson_'s avatar borisson_

Fix drupal coding standards

parent f3d9a934
...@@ -24,11 +24,8 @@ class FacetsQuery extends SearchQuery { ...@@ -24,11 +24,8 @@ class FacetsQuery extends SearchQuery {
* *
* @param array $query_info * @param array $query_info
* An associative array of query information. * An associative array of query information.
* @param $table_alias * @param string $table_alias
* The alias of the table being joined. * The alias of the table being joined.
*
* @return FacetsQuery
* An instance of this class.
*/ */
public function addFacetJoin(array $query_info, $table_alias) { public function addFacetJoin(array $query_info, $table_alias) {
if (isset($query_info['joins'][$table_alias])) { if (isset($query_info['joins'][$table_alias])) {
...@@ -46,7 +43,7 @@ class FacetsQuery extends SearchQuery { ...@@ -46,7 +43,7 @@ class FacetsQuery extends SearchQuery {
* @param array $query_info * @param array $query_info
* An associative array of query information. * An associative array of query information.
* *
* @return FacetsQuery * @return FacetsQuery
* An instance of this class. * An instance of this class.
*/ */
public function addFacetField(array $query_info) { public function addFacetField(array $query_info) {
...@@ -120,5 +117,5 @@ class FacetsQuery extends SearchQuery { ...@@ -120,5 +117,5 @@ class FacetsQuery extends SearchQuery {
public function getSearchExpression() { public function getSearchExpression() {
return $this->searchExpression; return $this->searchExpression;
} }
}
}
...@@ -10,12 +10,11 @@ namespace Drupal\core_search_facets\Plugin; ...@@ -10,12 +10,11 @@ namespace Drupal\core_search_facets\Plugin;
use Drupal\facets\FacetInterface; use Drupal\facets\FacetInterface;
/** /**
* * Additional interface for core facet sources.
* *
* A facet source is used to abstract the data source where facets can be added * A facet source is used to abstract the data source where facets can be added
* to. A good example of this is a search api view. There are other possible * to. A good example of this is a search api view. There are other possible
* facet data sources, these all implement the FacetSourceInterface. * facet data sources, these all implement the FacetSourceInterface.
*
*/ */
interface CoreSearchFacetSourceInterface { interface CoreSearchFacetSourceInterface {
...@@ -23,6 +22,7 @@ interface CoreSearchFacetSourceInterface { ...@@ -23,6 +22,7 @@ interface CoreSearchFacetSourceInterface {
* Sets the facet query object. * Sets the facet query object.
* *
* @return \Drupal\core_search_facets\FacetsQuery * @return \Drupal\core_search_facets\FacetsQuery
* The facet query object.
*/ */
public function getFacetQueryExtender(); public function getFacetQueryExtender();
...@@ -47,4 +47,3 @@ interface CoreSearchFacetSourceInterface { ...@@ -47,4 +47,3 @@ interface CoreSearchFacetSourceInterface {
public function getQueryInfo(FacetInterface $facet); public function getQueryInfo(FacetInterface $facet);
} }
...@@ -39,9 +39,9 @@ class NodeSearchFacets extends NodeSearch { ...@@ -39,9 +39,9 @@ class NodeSearchFacets extends NodeSearch {
Config $search_settings, Config $search_settings,
LanguageManagerInterface $language_manager, LanguageManagerInterface $language_manager,
RendererInterface $renderer, RendererInterface $renderer,
AccountInterface $account = NULL,
$facet_source_plugin_manager, $facet_source_plugin_manager,
$request_stack) { $request_stack,
AccountInterface $account = NULL) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $database, $entity_manager, $module_handler, $search_settings, $language_manager, $renderer, $account); parent::__construct($configuration, $plugin_id, $plugin_definition, $database, $entity_manager, $module_handler, $search_settings, $language_manager, $renderer, $account);
/** @var \Symfony\Component\HttpFoundation\RequestStack $request_stack */ /** @var \Symfony\Component\HttpFoundation\RequestStack $request_stack */
...@@ -65,9 +65,9 @@ class NodeSearchFacets extends NodeSearch { ...@@ -65,9 +65,9 @@ class NodeSearchFacets extends NodeSearch {
$container->get('config.factory')->get('search.settings'), $container->get('config.factory')->get('search.settings'),
$container->get('language_manager'), $container->get('language_manager'),
$container->get('renderer'), $container->get('renderer'),
$container->get('current_user'),
$container->get('plugin.manager.facets.facet_source'), $container->get('plugin.manager.facets.facet_source'),
$container->get('request_stack') $container->get('request_stack'),
$container->get('current_user')
); );
} }
...@@ -80,7 +80,7 @@ class NodeSearchFacets extends NodeSearch { ...@@ -80,7 +80,7 @@ class NodeSearchFacets extends NodeSearch {
$used_advanced = !empty($parameters[self::ADVANCED_FORM]); $used_advanced = !empty($parameters[self::ADVANCED_FORM]);
if ($used_advanced) { if ($used_advanced) {
$f = isset($parameters['f']) ? (array) $parameters['f'] : array(); $f = isset($parameters['f']) ? (array) $parameters['f'] : array();
$defaults = $this->parseAdvancedDefaults($f, $keys); $defaults = $this->parseAdvancedDefaults($f, $keys);
} }
else { else {
$defaults = array('keys' => $keys); $defaults = array('keys' => $keys);
...@@ -188,4 +188,3 @@ class NodeSearchFacets extends NodeSearch { ...@@ -188,4 +188,3 @@ class NodeSearchFacets extends NodeSearch {
} }
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/** /**
* @file * @file
* Contains \Drupal\core_search_facets\Plugin\facets\facet_source\CoreNodeSearchFacetSource * Contains \Drupal\core_search_facets\Plugin\facets\facet_source\CoreNodeSearchFacetSource.
*/ */
namespace Drupal\core_search_facets\Plugin\facets\facet_source; namespace Drupal\core_search_facets\Plugin\facets\facet_source;
...@@ -95,7 +95,7 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea ...@@ -95,7 +95,7 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea
$view->execute(); $view->execute();
return $view->getDisplay()->getOption('path');*/ return $view->getDisplay()->getOption('path');*/
return; return '';
} }
/** /**
...@@ -126,8 +126,13 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea ...@@ -126,8 +126,13 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea
} }
/** /**
* @param $field_id * Get the query types for a data type.
*
* @param string $field_id
* The field id.
*
* @return array * @return array
* An array of query types.
*/ */
public function getQueryTypesForDataType($field_id) { public function getQueryTypesForDataType($field_id) {
$query_types = []; $query_types = [];
...@@ -194,19 +199,20 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea ...@@ -194,19 +199,20 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getFacetQueryExtender() { public function getFacetQueryExtender() {
//if (!$this->facetQueryExtender) { // If (!$this->facetQueryExtender) {
// $this->facetQueryExtender = db_select('search_index',
//$this->facetQueryExtender = db_select('search_index', 'i', array('target' => 'replica'))->extend('Drupal\search\ViewsSearchQuery'); // 'i',
//$this->searchQuery->searchExpression($input, $this->searchType); // array('target' => 'replica'))
//$this->searchQuery->publicParseSearchExpression(); // ->extend('Drupal\search\ViewsSearchQuery');
// $this->searchQuery->searchExpression($input, $this->searchType);
// $this->searchQuery->publicParseSearchExpression();
$this->facetQueryExtender = db_select('search_index', 'i', array('target' => 'replica'))->extend('Drupal\core_search_facets\FacetsQuery'); $this->facetQueryExtender = db_select('search_index', 'i', array('target' => 'replica'))->extend('Drupal\core_search_facets\FacetsQuery');
$this->facetQueryExtender->join('node_field_data', 'n', 'n.nid = i.sid'); $this->facetQueryExtender->join('node_field_data', 'n', 'n.nid = i.sid');
$this->facetQueryExtender $this->facetQueryExtender
//->condition('n.status', 1) // ->condition('n.status', 1).
->addTag('node_access') ->addTag('node_access')
->searchExpression($this->keys, 'node_search'); ->searchExpression($this->keys, 'node_search');
//} // }.
return $this->facetQueryExtender; return $this->facetQueryExtender;
} }
...@@ -214,45 +220,45 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea ...@@ -214,45 +220,45 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getQueryInfo(FacetInterface $facet) { public function getQueryInfo(FacetInterface $facet) {
//if (!$facet['field api name']) { // If (!$facet['field api name']) {
// We add the language code of the indexed item to the result of the query. // We add the language code of the indexed item to the result of the query.
// So in this case we need to use the search_index table alias (i) for the // So in this case we need to use the search_index table alias (i) for the
// langcode field. Otherwise we will have same nid for multiple languages // langcode field. Otherwise we will have same nid for multiple languages
// as result. For more details see NodeSearch::findResults(). // as result. For more details see NodeSearch::findResults().
$table_alias = $facet->getFieldIdentifier() == 'langcode' ? 'i' : 'n'; $table_alias = $facet->getFieldIdentifier() == 'langcode' ? 'i' : 'n';
$query_info = [ $query_info = [
'fields' => [ 'fields' => [
$table_alias . '.' . $facet->getFieldIdentifier() => [ $table_alias . '.' . $facet->getFieldIdentifier() => [
'table_alias' => $table_alias, 'table_alias' => $table_alias,
'field' => $facet->getFieldIdentifier(), 'field' => $facet->getFieldIdentifier(),
],
], ],
]; ],
//} ];
// }
/*else { /*else {
$query_info = array(); $query_info = array();
// Gets field info, finds table name and field name. // Gets field info, finds table name and field name.
$field = field_info_field($facet['field api name']); $field = field_info_field($facet['field api name']);
$table = _field_sql_storage_tablename($field); $table = _field_sql_storage_tablename($field);
// Iterates over columns, adds fields to query info. // Iterates over columns, adds fields to query info.
foreach ($field['columns'] as $column_name => $attributes) { foreach ($field['columns'] as $column_name => $attributes) {
$column = _field_sql_storage_columnname($field['field_name'], $column_name); $column = _field_sql_storage_columnname($field['field_name'], $column_name);
$query_info['fields'][$table . '.' . $column] = array( $query_info['fields'][$table . '.' . $column] = array(
'table_alias' => $table, 'table_alias' => $table,
'field' => $column, 'field' => $column,
); );
} }
// Adds the join on the node table. // Adds the join on the node table.
$query_info['joins'] = array( $query_info['joins'] = array(
$table => array( $table => array(
'table' => $table, 'table' => $table,
'alias' => $table, 'alias' => $table,
'condition' => "n.vid = $table.revision_id", 'condition' => "n.vid = $table.revision_id",
), ),
); );
}*/ }*/
// Returns query info, makes sure all keys are present. // Returns query info, makes sure all keys are present.
...@@ -263,12 +269,14 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea ...@@ -263,12 +269,14 @@ class CoreNodeSearchFacetSource extends FacetSourcePluginBase implements CoreSea
} }
/** /**
* Checks if the search has facets.
*
* @TODO move to the Base class??? * @TODO move to the Base class???
*/ */
public function hasFacets() { public function hasFacets() {
$manager = \Drupal::service('entity_type.manager')->getStorage('facets_facet'); $manager = \Drupal::service('entity_type.manager')->getStorage('facets_facet');
$facets = $manager->loadMultiple(); $facets = $manager->loadMultiple();
foreach($facets as $facet) { foreach ($facets as $facet) {
if ($facet->getFacetSourceId() == $this->getPluginId()) { if ($facet->getFacetSourceId() == $this->getPluginId()) {
return TRUE; return TRUE;
} }
......
...@@ -20,6 +20,9 @@ class CoreNodeSearchFacetSourceDeriver extends FacetSourceDeriverBase { ...@@ -20,6 +20,9 @@ class CoreNodeSearchFacetSourceDeriver extends FacetSourceDeriverBase {
protected $searchManager; protected $searchManager;
/**
* Create an instance of the deriver.
*/
public function __construct(ContainerInterface $container, $base_plugin_id, $search_manager, $entity_type_manager) { public function __construct(ContainerInterface $container, $base_plugin_id, $search_manager, $entity_type_manager) {
$this->searchManager = $search_manager; $this->searchManager = $search_manager;
$this->entityTypeManager = $entity_type_manager; $this->entityTypeManager = $entity_type_manager;
...@@ -48,15 +51,15 @@ class CoreNodeSearchFacetSourceDeriver extends FacetSourceDeriverBase { ...@@ -48,15 +51,15 @@ class CoreNodeSearchFacetSourceDeriver extends FacetSourceDeriverBase {
$pages = $this->entityTypeManager->getStorage('search_page')->loadMultiple(); $pages = $this->entityTypeManager->getStorage('search_page')->loadMultiple();
foreach($pages as $machine_name => $page) { foreach ($pages as $machine_name => $page) {
/** @var \Drupal\search\Entity\SearchPage $page * */ /* @var \Drupal\search\Entity\SearchPage $page * */
if ($page->get('plugin') == 'node_search') { if ($page->get('plugin') == 'node_search') {
// Detect if the plugin has "faceted" definition. // Detect if the plugin has "faceted" definition.
$plugin_derivatives[$machine_name] = [ $plugin_derivatives[$machine_name] = [
'id' => $base_plugin_id . PluginBase::DERIVATIVE_SEPARATOR . $machine_name, 'id' => $base_plugin_id . PluginBase::DERIVATIVE_SEPARATOR . $machine_name,
'label' => $this->t('Core Search Page: %page_name', ['%page_name' => $page->get('label')]), 'label' => $this->t('Core Search Page: %page_name', ['%page_name' => $page->get('label')]),
'description' => $this->t('Provides a facet source.'), 'description' => $this->t('Provides a facet source.'),
] + $base_plugin_definition; ] + $base_plugin_definition;
} }
uasort($plugin_derivatives, array($this, 'compareDerivatives')); uasort($plugin_derivatives, array($this, 'compareDerivatives'));
......
...@@ -11,6 +11,7 @@ use Drupal\facets\QueryType\QueryTypePluginBase; ...@@ -11,6 +11,7 @@ use Drupal\facets\QueryType\QueryTypePluginBase;
use Drupal\facets\Result\Result; use Drupal\facets\Result\Result;
/** /**
* A string query type for core.
* *
* @FacetsQueryType( * @FacetsQueryType(
* id = "core_node_search_string", * id = "core_node_search_string",
...@@ -31,11 +32,11 @@ class CoreNodeSearchString extends QueryTypePluginBase { ...@@ -31,11 +32,11 @@ class CoreNodeSearchString extends QueryTypePluginBase {
*/ */
public function execute() { public function execute() {
/** @var \Drupal\core_search_facets\Plugin\CoreSearchFacetSourceInterface $facetSource */ /** @var \Drupal\core_search_facets\Plugin\CoreSearchFacetSourceInterface $facet_source */
$facetSource = $this->facet->getFacetSource(); $facet_source = $this->facet->getFacetSource();
$query_info = $facetSource->getQueryInfo($this->facet); $query_info = $facet_source->getQueryInfo($this->facet);
/** @var \Drupal\core_search_facets\FacetsQuery $facet_query */ /** @var \Drupal\core_search_facets\FacetsQuery $facet_query */
$facet_query = $facetSource->getFacetQueryExtender(); $facet_query = $facet_source->getFacetQueryExtender();
$tables_joined = []; $tables_joined = [];
// Add the filter to the query if there are active values. // Add the filter to the query if there are active values.
...@@ -49,11 +50,12 @@ class CoreNodeSearchString extends QueryTypePluginBase { ...@@ -49,11 +50,12 @@ class CoreNodeSearchString extends QueryTypePluginBase {
// Adds adds join to search query, makes sure it is only added once. // Adds adds join to search query, makes sure it is only added once.
if (isset($query_info['joins'][$field_info['table_alias']])) { if (isset($query_info['joins'][$field_info['table_alias']])) {
if (!isset($tables_joined[$field_info['table_alias']])) { if (!isset($tables_joined[$field_info['table_alias']])) {
$tables_joined[$field_info['table_alias']] = TRUE; $tables_joined[$field_info['table_alias']] = TRUE;
$join_info = $query_info['joins'][$field_info['table_alias']]; $join_info = $query_info['joins'][$field_info['table_alias']];
$this->query->join($join_info['table'], $join_info['alias'], $join_info['condition']); $this->query->join($join_info['table'], $join_info['alias'],
} $join_info['condition']);
}
}*/ }*/
// Adds facet conditions to the queries. // Adds facet conditions to the queries.
...@@ -68,12 +70,12 @@ class CoreNodeSearchString extends QueryTypePluginBase { ...@@ -68,12 +70,12 @@ class CoreNodeSearchString extends QueryTypePluginBase {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function build() { public function build() {
/** @var \Drupal\core_search_facets\Plugin\CoreSearchFacetSourceInterface $facetSource */ /* @var \Drupal\core_search_facets\Plugin\CoreSearchFacetSourceInterface $facet_source */
$facetSource = $this->facet->getFacetSource(); $facet_source = $this->facet->getFacetSource();
$query_info = $facetSource->getQueryInfo($this->facet); $query_info = $facet_source->getQueryInfo($this->facet);
/** @var \Drupal\core_search_facets\FacetsQuery $facet_query */ /** @var \Drupal\core_search_facets\FacetsQuery $facet_query */
$facet_query = $facetSource->getFacetQueryExtender(); $facet_query = $facet_source->getFacetQueryExtender();
$facet_query->addFacetField($query_info); $facet_query->addFacetField($query_info);
...@@ -94,4 +96,3 @@ class CoreNodeSearchString extends QueryTypePluginBase { ...@@ -94,4 +96,3 @@ class CoreNodeSearchString extends QueryTypePluginBase {
} }
} }
...@@ -41,4 +41,4 @@ ...@@ -41,4 +41,4 @@
.facets-processor-settings-facet { .facets-processor-settings-facet {
margin-left: 20px; margin-left: 20px;
margin-bottom: 20px; margin-bottom: 20px;
} }
\ No newline at end of file
...@@ -26,9 +26,10 @@ class FacetContextProvider implements ContextProviderInterface { ...@@ -26,9 +26,10 @@ class FacetContextProvider implements ContextProviderInterface {
protected $facetStorage; protected $facetStorage;
/** /**
* Create a new instance of the context provider. * Creates a new instance of the context provider.
* *
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/ */
public function __construct(EntityTypeManagerInterface $entity_type_manager) { public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->facetStorage = $entity_type_manager->getStorage('facets_facet'); $this->facetStorage = $entity_type_manager->getStorage('facets_facet');
......
...@@ -51,7 +51,7 @@ class FacetController extends ControllerBase { ...@@ -51,7 +51,7 @@ class FacetController extends ControllerBase {
* Returns a form to edit a facet on a search api index. * Returns a form to edit a facet on a search api index.
* *
* @param \Drupal\facets\FacetInterface $facets_facet * @param \Drupal\facets\FacetInterface $facets_facet
* Facet currently being edited * Facet currently being edited.
* *
* @return array * @return array
* The facet edit form. * The facet edit form.
...@@ -64,7 +64,7 @@ class FacetController extends ControllerBase { ...@@ -64,7 +64,7 @@ class FacetController extends ControllerBase {
/** /**
* Returns the page title for an facets's "View" tab. * Returns the page title for an facets's "View" tab.
* *
* @param \Drupal\facets/FacetInterface $facet * @param \Drupal\facets\FacetInterface $facet
* The facet that is displayed. * The facet that is displayed.
* *
* @return string * @return string
......
...@@ -131,7 +131,7 @@ class Facet extends ConfigEntityBase implements FacetInterface { ...@@ -131,7 +131,7 @@ class Facet extends ConfigEntityBase implements FacetInterface {
/** /**
* The facet source belonging to this facet. * The facet source belonging to this facet.
* *
* @var \Drupal\facets\FacetSourceInterface * @var \Drupal\facets\FacetSource\FacetSourceInterface
* *
* @see getFacetSource() * @see getFacetSource()
*/ */
...@@ -170,6 +170,8 @@ class Facet extends ConfigEntityBase implements FacetInterface { ...@@ -170,6 +170,8 @@ class Facet extends ConfigEntityBase implements FacetInterface {
protected $processors; protected $processors;
/** /**
* Is the facet only visible when the facet source is only visible.
*
* A boolean that defines whether or not the facet is only visible when the * A boolean that defines whether or not the facet is only visible when the
* facet source is visible. * facet source is visible.
* *
...@@ -192,12 +194,15 @@ class Facet extends ConfigEntityBase implements FacetInterface { ...@@ -192,12 +194,15 @@ class Facet extends ConfigEntityBase implements FacetInterface {
} }
/** /**
* Gets the widget plugin manager.
*
* @return \Drupal\facets\Widget\WidgetPluginManager * @return \Drupal\facets\Widget\WidgetPluginManager
* The widget plugin manager.
*/ */
public function getWidgetManager() { public function getWidgetManager() {
$container = \Drupal::getContainer(); $container = \Drupal::getContainer();
return $this->widget_plugin_manager ? : $container->get('plugin.manager.facets.widget'); return $this->widget_plugin_manager ?: $container->get('plugin.manager.facets.widget');
} }
/** /**
...@@ -245,9 +250,7 @@ class Facet extends ConfigEntityBase implements FacetInterface { ...@@ -245,9 +250,7 @@ class Facet extends ConfigEntityBase implements FacetInterface {
} }
/** /**
* Get the field alias used to identify the facet in the url. * {@inheritdoc}
*
* @return mixed
*/ */
public function getFieldAlias() { public function getFieldAlias() {
// For now, create the field alias based on the field identifier. // For now, create the field alias based on the field identifier.
...@@ -256,9 +259,7 @@ class Facet extends ConfigEntityBase implements FacetInterface { ...@@ -256,9 +259,7 @@ class Facet extends ConfigEntityBase implements FacetInterface {
} }
/** /**
* Sets an item with value to active. * {@inheritdoc}
*
* @param $value
*/ */
public function setActiveItem($value) { public function setActiveItem($value) {
if (!in_array($value, $this->active_values)) { if (!in_array($value, $this->active_values)) {
...@@ -267,9 +268,7 @@ class Facet extends ConfigEntityBase implements FacetInterface { ...@@ -267,9 +268,7 @@ class Facet extends ConfigEntityBase implements FacetInterface {
} }
/** /**
* Get all the active items in the facet. * {@inheritdoc}
*
* @return mixed
*/ */
public function getActiveItems() { public function getActiveItems() {
return $this->active_values; return $this->active_values;
...@@ -356,7 +355,7 @@ class Facet extends ConfigEntityBase implements FacetInterface { ...@@ -356,7 +355,7 @@ class Facet extends ConfigEntityBase implements FacetInterface {
public function getFacetSource() { public function getFacetSource() {
if (!$this->facet_source_instance && $this->facet_source_id) { if (!$this->facet_source_instance && $this->facet_source_id) {
/** @var $facet_source_plugin_manager \Drupal\facets\FacetSource\FacetSourcePluginManager */ /* @var $facet_source_plugin_manager \Drupal\facets\FacetSource\FacetSourcePluginManager */
$facet_source_plugin_manager = \Drupal::service('plugin.manager.facets.facet_source'); $facet_source_plugin_manager = \Drupal::service('plugin.manager.facets.facet_source');
$this->facet_source_instance = $facet_source_plugin_manager->createInstance($this->facet_source_id); $this->facet_source_instance = $facet_source_plugin_manager->createInstance($this->facet_source_id);
} }
...@@ -379,7 +378,7 @@ class Facet extends ConfigEntityBase implements FacetInterface { ...@@ -379,7 +378,7 @@ class Facet extends ConfigEntityBase implements FacetInterface {
*/ */
protected function loadProcessors() { protected function loadProcessors() {
if (!isset($this->processors)) { if (!isset($this->processors)) {
/** @var $processor_plugin_manager \Drupal\facets\Processor\ProcessorPluginManager */ /* @var $processor_plugin_manager \Drupal\facets\Processor\ProcessorPluginManager */
$processor_plugin_manager = \Drupal::service('plugin.manager.facets.processor'); $processor_plugin_manager = \Drupal::service('plugin.manager.facets.processor');
$processor_settings = $this->getOption('processors', []); $processor_settings = $this->getOption('processors', []);
...@@ -389,7 +388,7 @@ class Facet extends ConfigEntityBase implements FacetInterface { ...@@ -389,7 +388,7 @@ class Facet extends ConfigEntityBase implements FacetInterface {
$settings = empty($processor_settings[$name]['settings']) ? [] : $processor_settings[$name]['settings']; $settings = empty($processor_settings[$name]['settings']) ? [] : $processor_settings[$name]['settings'];
$settings['facet'] = $this; $settings['facet'] = $this;
/** @var $processor \Drupal\facets\Processor\ProcessorInterface */ /* @var $processor \Drupal\facets\Processor\ProcessorInterface */
$processor = $processor_plugin_manager->createInstance($name, $settings); $processor = $processor_plugin_manager->createInstance($name, $settings);
$this->processors[$name] = $processor; $this->processors[$name] = $processor;
} }
...@@ -418,10 +417,7 @@ class Facet extends ConfigEntityBase implements FacetInterface { ...@@ -418,10 +417,7 @@ class Facet extends ConfigEntityBase implements FacetInterface {
} }
/** /**
* Set an array of Result objects. * {@inheritdoc}
*
* @param array $results
* Array containing \Drupal\facets\Result\Result objects.
*/ */
public function setResults(array $results) { public function setResults(array $results) {
$this->results = $results; $this->results = $results;
...@@ -437,16 +433,7 @@ class Facet extends ConfigEntityBase implements FacetInterface { ...@@ -437,16 +433,7 @@ class Facet extends ConfigEntityBase implements FacetInterface {
} }
/** /**
* Until facets supports more than just search api, this is enough. * {@inheritdoc}
*
* @return string
*/
public function getManagerPluginId() {
return 'facets_default';
}
/**
* @inheritdoc
*/ */
public function isActiveValue($value) { public function isActiveValue($value) {
$is_active = FALSE; $is_active = FALSE;
...@@ -463,7 +450,7 @@ class Facet extends ConfigEntityBase implements FacetInterface { ...@@ -463,7 +450,7 @@ class Facet extends ConfigEntityBase implements FacetInterface {
if (!isset($this->facetSourcePlugins)) { if (!isset($this->facetSourcePlugins)) {
$this->facetSourcePlugins = []; $this->facetSourcePlugins = [];
/** @var $facet_source_plugin_manager \Drupal\facets\FacetSource\FacetSourcePluginManager */ /* @var $facet_source_plugin_manager \Drupal\facets\FacetSource\FacetSourcePluginManager */
$facet_source_plugin_manager = \Drupal::service('plugin.manager.facets.facet_source'); $facet_source_plugin_manager = \Drupal::service('plugin.manager.facets.facet_source');
foreach ($facet_source_plugin_manager->getDefinitions() as $name => $facet_source_definition) { foreac