Renamed the module's machine name from islandora_advanced_search to `advanced_search

This commit is contained in:
Kyle Huynh 2021-12-09 10:06:25 -05:00
parent c210ee062c
commit a3cca6bc37
36 changed files with 130 additions and 130 deletions

View file

@ -1,13 +1,13 @@
<?php
namespace Drupal\islandora_advanced_search;
namespace Drupal\advanced_search;
use Drupal\block\Entity\Block;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\Core\Form\FormBuilderInterface;
use Drupal\Core\Url;
use Drupal\islandora_advanced_search\Form\SettingsForm;
use Drupal\islandora_advanced_search\Plugin\Block\AdvancedSearchBlock;
use Drupal\advanced_search\Form\SettingsForm;
use Drupal\advanced_search\Plugin\Block\AdvancedSearchBlock;
use Drupal\search_api\Query\QueryInterface as DrupalQueryInterface;
use Drupal\views\ViewExecutable;
use Solarium\Core\Query\QueryInterface as SolariumQueryInterface;
@ -78,7 +78,7 @@ class AdvancedSearchQuery {
* @param \Symfony\Component\HttpFoundation\Request $request
* The request to parse terms from.
*
* @return \Drupal\islandora_advanced_search\AdvancedSearchQueryTerm[]
* @return \Drupal\advanced_search\AdvancedSearchQueryTerm[]
* A list of search terms.
*/
public function getTerms(Request $request) {
@ -114,7 +114,7 @@ class AdvancedSearchQuery {
/**
* Checks if the all of the given terms are negations or not.
*
* @param \Drupal\islandora_advanced_search\AdvancedSearchQueryTerm[] $terms
* @param \Drupal\advanced_search\AdvancedSearchQueryTerm[] $terms
* The terms to search for.
*
* @return bool
@ -148,10 +148,10 @@ class AdvancedSearchQuery {
$backend = $index->getServerInstance()->getBackend();
$language_ids = $search_api_query->getLanguages();
$field_mapping = $backend->getSolrFieldNamesKeyedByLanguage($language_ids, $index);
// disable for Lucene and wildcard
//$q[] = "{!boost b=boost_document}";
// To support negative queries we must first bring in all documents.
$q[] = $this->negativeQuery($terms) ? "*:*" : "";
$term = array_shift($terms);
@ -197,7 +197,7 @@ class AdvancedSearchQuery {
$dismax->setQueryFields($query_fields);
}
$solarium_query->setQuery($q);
}
}
}
/**

View file

@ -1,8 +1,8 @@
<?php
namespace Drupal\islandora_advanced_search;
namespace Drupal\advanced_search;
use Drupal\islandora_advanced_search\Form\AdvancedSearchForm;
use Drupal\advanced_search\Form\AdvancedSearchForm;
/**
* Defines a single search term.
@ -17,7 +17,7 @@ class AdvancedSearchQueryTerm {
const CONJUNCTION_OR = 'OR';
// Used for serializing / deserializing query parameters.
// These are also hard-coded in islandora_advanced_search.form.js.
// These are also hard-coded in advanced_search.form.js.
const CONJUNCTION_QUERY_PARAMETER = 'c';
const FIELD_QUERY_PARAMETER = 'f';
const INCLUDE_QUERY_PARAMETER = 'i';
@ -139,7 +139,7 @@ class AdvancedSearchQueryTerm {
* @param array $params
* An array representing the query parameters for a single search term.
*
* @return \Drupal\islandora_advanced_search\AdvancedSearchQueryTerm|null
* @return \Drupal\advanced_search\AdvancedSearchQueryTerm|null
* An object which represents a valid search term.
*/
public static function fromQueryParams(array $params) {
@ -168,7 +168,7 @@ class AdvancedSearchQueryTerm {
* @param array $input
* An array representing the submitted form values for a single search term.
*
* @return \Drupal\islandora_advanced_search\AdvancedSearchQueryTerm|null
* @return \Drupal\advanced_search\AdvancedSearchQueryTerm|null
* An object which represents a valid search term.
*/
public static function fromUserInput(array $input) {

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Controller;
namespace Drupal\advanced_search\Controller;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\ReplaceCommand;

View file

@ -1,15 +1,15 @@
<?php
namespace Drupal\islandora_advanced_search\Form;
namespace Drupal\advanced_search\Form;
use Drupal\Component\Utility\Html;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\islandora_advanced_search\AdvancedSearchQuery;
use Drupal\islandora_advanced_search\AdvancedSearchQueryTerm;
use Drupal\islandora_advanced_search\GetConfigTrait;
use Drupal\advanced_search\AdvancedSearchQuery;
use Drupal\advanced_search\AdvancedSearchQueryTerm;
use Drupal\advanced_search\GetConfigTrait;
use Drupal\views\DisplayPluginCollection;
use Drupal\views\Entity\View;
use Drupal\views\Plugin\views\display\PathPluginBase;
@ -36,7 +36,7 @@ class AdvancedSearchForm extends FormBase {
const NOT_OP = 'NOT';
const OR_OP = 'OR';
// These are also hard-coded in islandora_advanced_search.form.js.
// These are also hard-coded in advanced_search.form.js.
const CONJUNCTION_FORM_FIELD = 'conjunction';
const SEARCH_FORM_FIELD = 'search';
const INCLUDE_FORM_FIELD = 'include';
@ -80,7 +80,7 @@ class AdvancedSearchForm extends FormBase {
* {@inheritdoc}
*/
public function getFormId() {
return 'islandora_advanced_search_form';
return 'advanced_search_form';
}
/**
@ -249,8 +249,8 @@ class AdvancedSearchForm extends FormBase {
$route_name = $this->getRouteName($form_state);
$requires_redirect = $route_name ? $this->currentRouteMatch->getRouteName() !== $route_name : FALSE;
$form['#attached']['library'][] = 'islandora_advanced_search/advanced.search.form';
$form['#attached']['drupalSettings']['islandora_advanced_search_form'] = [
$form['#attached']['library'][] = 'advanced_search/advanced.search.form';
$form['#attached']['drupalSettings']['advanced_search_form'] = [
'id' => Html::getId($this->getFormId()),
'redirect' => $requires_redirect,
'query_parameter' => AdvancedSearchQuery::getQueryParameter(),

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Form;
namespace Drupal\advanced_search\Form;
use Drupal\Core\Form\FormBase;

View file

@ -1,12 +1,12 @@
<?php
namespace Drupal\islandora_advanced_search\Form;
namespace Drupal\advanced_search\Form;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\islandora_advanced_search\AdvancedSearchQuery;
use Drupal\islandora_advanced_search\GetConfigTrait;
use Drupal\advanced_search\AdvancedSearchQuery;
use Drupal\advanced_search\GetConfigTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@ -16,7 +16,7 @@ class SettingsForm extends ConfigFormBase {
use GetConfigTrait;
const CONFIG_NAME = 'islandora_advanced_search.settings';
const CONFIG_NAME = 'advanced_search.settings';
const SEARCH_QUERY_PARAMETER = 'search_query_parameter';
const SEARCH_RECURSIVE_PARAMETER = 'search_recursive_parameter';
const SEARCH_ADD_OPERATOR = 'search_add_operator';
@ -47,7 +47,7 @@ class SettingsForm extends ConfigFormBase {
* {@inheritdoc}
*/
public function getFormId() {
return 'islandora_advanced_search_settings_form';
return 'advanced_search_settings_form';
}
/**

View file

@ -1,8 +1,8 @@
<?php
namespace Drupal\islandora_advanced_search;
namespace Drupal\advanced_search;
use Drupal\islandora_advanced_search\Form\SettingsForm;
use Drupal\advanced_search\Form\SettingsForm;
/**
* Simple trait for accessing this modules configuration.

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\Block;
namespace Drupal\advanced_search\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormBuilderInterface;
@ -15,8 +15,8 @@ use Symfony\Component\HttpFoundation\Request;
* Provides an Islandora Advanced Search block.
*
* @Block(
* id = "islandora_advanced_search_block",
* deriver = "Drupal\islandora_advanced_search\Plugin\Block\AdvancedSearchBlockDeriver",
* id = "advanced_search_block",
* deriver = "Drupal\advanced_search\Plugin\Block\AdvancedSearchBlockDeriver",
* admin_label = @Translation("Islandora Advanced Search"),
* category = @Translation("Islandora"),
* )
@ -343,7 +343,7 @@ class AdvancedSearchBlock extends BlockBase implements ContainerFactoryPluginInt
];
}
$form['#attributes']['class'][] = 'clearfix';
$form['#attached']['library'][] = 'islandora_advanced_search/advanced.search.admin';
$form['#attached']['library'][] = 'advanced_search/advanced.search.admin';
return $form;
}
@ -371,7 +371,7 @@ class AdvancedSearchBlock extends BlockBase implements ContainerFactoryPluginInt
foreach ($this->configuration[self::SETTING_FIELDS] as $identifier) {
$configured_fields[$identifier] = $fields[$identifier];
}
return $this->formBuilder->getForm('Drupal\islandora_advanced_search\Form\AdvancedSearchForm', $this->view, $this->display, $configured_fields, $this->configuration[self::SETTING_CONTEXTUAL_FILTER]);
return $this->formBuilder->getForm('Drupal\advanced_search\Form\AdvancedSearchForm', $this->view, $this->display, $configured_fields, $this->configuration[self::SETTING_CONTEXTUAL_FILTER]);
}
/**

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\Block;
namespace Drupal\advanced_search\Plugin\Block;
/**
* Deriver for AdvancedSearchBlock.

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\Block;
namespace Drupal\advanced_search\Plugin\Block;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\Block;
namespace Drupal\advanced_search\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormStateInterface;
@ -84,7 +84,7 @@ class SearchBlock extends BlockBase {
* {@inheritdoc}
*/
public function build() {
return \Drupal::formBuilder()->getForm('Drupal\islandora_advanced_search\Form\SearchForm');
return \Drupal::formBuilder()->getForm('Drupal\advanced_search\Form\SearchForm');
}
}

View file

@ -1,12 +1,12 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\Block;
namespace Drupal\advanced_search\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Render\Markup;
use Drupal\Core\Url;
use Drupal\islandora_advanced_search\AdvancedSearchQuery;
use Drupal\advanced_search\AdvancedSearchQuery;
use Drupal\views\Entity\View;
use Drupal\views\Plugin\views\pager\SqlBase;
use Drupal\views\ViewExecutable;
@ -17,8 +17,8 @@ use Symfony\Component\HttpFoundation\Request;
* Provides a 'AjaxViewBlock' block.
*
* @Block(
* id = "islandora_advanced_search_result_pager",
* deriver = "Drupal\islandora_advanced_search\Plugin\Block\SearchResultsPagerBlockDeriver",
* id = "advanced_search_result_pager",
* deriver = "Drupal\advanced_search\Plugin\Block\SearchResultsPagerBlockDeriver",
* admin_label = @Translation("Search Results Pager"),
* category = @Translation("Islandora"),
* )
@ -81,7 +81,7 @@ class SearchResultsPagerBlock extends BlockBase implements ContainerFactoryPlugi
$build = [
'#attached' => [
'drupalSettings' => [
'islandora_advanced_search_pager_views_ajax' => [
'advanced_search_pager_views_ajax' => [
$id => [
'view_id' => $view_id,
'current_display_id' => $display_id,
@ -91,7 +91,7 @@ class SearchResultsPagerBlock extends BlockBase implements ContainerFactoryPlugi
],
],
'#attributes' => [
'class' => ['islandora_advanced_search_result_pager'],
'class' => ['advanced_search_result_pager'],
'data-drupal-pager-id' => $id,
],
'result_summary' => $this->buildResultsSummary($view_executable),

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\Block;
namespace Drupal\advanced_search\Plugin\Block;
/**
* This deriver creates a block for every search_api.display.

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\Block;
namespace Drupal\advanced_search\Plugin\Block;
/**
* Gets the view and display identifiers used to create this block.

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\Field\FieldFormatter;
namespace Drupal\advanced_search\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase;

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\facets\widget;
namespace Drupal\advanced_search\Plugin\facets\widget;
use Drupal\facets\Plugin\facets\widget\LinksWidget;
use Drupal\Core\Link;

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\facets_summary\processor;
namespace Drupal\advanced_search\Plugin\facets_summary\processor;
use Drupal\facets_summary\FacetsSummaryInterface;
use Drupal\facets_summary\Processor\BuildProcessorInterface;

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\facets_summary\processor;
namespace Drupal\advanced_search\Plugin\facets_summary\processor;
use Drupal\facets_summary\FacetsSummaryInterface;
use Drupal\facets_summary\Processor\BuildProcessorInterface;

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\facets_summary\processor;
namespace Drupal\advanced_search\Plugin\facets_summary\processor;
use Drupal\Core\Link;
use Drupal\facets_summary\FacetsSummaryInterface;

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\facets_summary\processor;
namespace Drupal\advanced_search\Plugin\facets_summary\processor;
use Drupal\Core\Link;
use Drupal\Core\Url;

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\facets_summary\processor;
namespace Drupal\advanced_search\Plugin\facets_summary\processor;
use Drupal\facets_summary\FacetsSummaryInterface;
use Drupal\facets_summary\Processor\BuildProcessorInterface;

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\islandora_advanced_search\Plugin\facets_summary\processor;
namespace Drupal\advanced_search\Plugin\facets_summary\processor;
use Drupal\Core\Link;
use Drupal\Core\Url;

View file

@ -1,9 +1,9 @@
<?php
namespace Drupal\islandora_advanced_search;
namespace Drupal\advanced_search;
use Drupal\islandora_advanced_search\Plugin\Block\AdvancedSearchBlock;
use Drupal\islandora_advanced_search\Plugin\Block\SearchResultsPagerBlock;
use Drupal\advanced_search\Plugin\Block\AdvancedSearchBlock;
use Drupal\advanced_search\Plugin\Block\SearchResultsPagerBlock;
/**
* Helper functions.