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

@ -41,7 +41,7 @@ composer require drupal/search_api_solr "^4.1"
composer require drupal/search_api "^1.5" composer require drupal/search_api "^1.5"
``` ```
However, for reference, `islandora_advanced_search` requires the following However, for reference, `advanced_search` requires the following
drupal modules: drupal modules:
- [facets](https://www.drupal.org/project/facets) - [facets](https://www.drupal.org/project/facets)
@ -53,7 +53,7 @@ To download/enable just this module, use the following from the command line:
```bash ```bash
composer require islandora/islandora composer require islandora/islandora
drush en islandora_advanced_search drush en advanced_search
``` ```
## Configuration ## Configuration
@ -61,7 +61,7 @@ drush en islandora_advanced_search
You can set the following configuration at You can set the following configuration at
`admin/config/islandora/advanced_search`: `admin/config/islandora/advanced_search`:
![image](./docs/islandora_advanced_search_settings.png) ![image](./docs/advanced_search_settings.png)
## Configuring Solr ## Configuring Solr

View file

@ -0,0 +1,17 @@
advanced.search.admin:
js:
js/advanced_search.admin.js: {}
dependencies:
- core/drupal.tabledrag
advanced.search.form:
js:
js/advanced_search.form.js: {}
css:
component:
css/advanced_search.form.css: {}
advanced.search.pager:
css:
component:
css/advanced_search.pager.css: {}

View file

@ -1,6 +1,6 @@
islandora_advanced_search.settings: advanced_search.settings:
title: 'Advanced Search Settings' title: 'Advanced Search Settings'
route_name: islandora_advanced_search.settings route_name: advanced_search.settings
description: 'Configure Islandora Advanced Search settings' description: 'Configure Islandora Advanced Search settings'
parent: system.admin_config_islandora parent: system.admin_config_islandora
weight: 99 weight: 99

View file

@ -2,7 +2,7 @@
/** /**
* @file * @file
* Contains islandora_advanced_search.module. * Contains advanced_search.module.
* *
* This file is part of the Islandora Project. * This file is part of the Islandora Project.
* *
@ -15,9 +15,9 @@
use Drupal\block\Entity\Block; use Drupal\block\Entity\Block;
use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\Unicode;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\islandora_advanced_search\AdvancedSearchQuery; use Drupal\advanced_search\AdvancedSearchQuery;
use Drupal\islandora_advanced_search\Form\SettingsForm; use Drupal\advanced_search\Form\SettingsForm;
use Drupal\islandora_advanced_search\Utilities; use Drupal\advanced_search\Utilities;
use Drupal\search_api\Query\QueryInterface as DrupalQueryInterface; use Drupal\search_api\Query\QueryInterface as DrupalQueryInterface;
use Drupal\views\ViewExecutable; use Drupal\views\ViewExecutable;
use Solarium\Core\Query\QueryInterface as SolariumQueryInterface; use Solarium\Core\Query\QueryInterface as SolariumQueryInterface;
@ -25,7 +25,7 @@ use Solarium\Core\Query\QueryInterface as SolariumQueryInterface;
/** /**
* Implements hook_theme(). * Implements hook_theme().
*/ */
function islandora_advanced_search_theme() { function advanced_search_theme() {
return [ return [
'facets_item_list__include_exclude_links' => [ 'facets_item_list__include_exclude_links' => [
'template' => 'facets/facets-item-list--include-exclude-links', 'template' => 'facets/facets-item-list--include-exclude-links',
@ -45,10 +45,10 @@ function islandora_advanced_search_theme() {
/** /**
* Implements hook_library_info_alter(). * Implements hook_library_info_alter().
*/ */
function islandora_advanced_search_library_info_alter(&$libraries, $extension) { function advanced_search_library_info_alter(&$libraries, $extension) {
if ($extension == 'facets') { if ($extension == 'facets') {
// Override facets module javascript with customizations. // Override facets module javascript with customizations.
$path = '/' . drupal_get_path('module', 'islandora_advanced_search') . '/js/facets'; $path = '/' . drupal_get_path('module', 'advanced_search') . '/js/facets';
$libraries['soft-limit']['js'] = [ $libraries['soft-limit']['js'] = [
"$path/soft-limit.js" => [], "$path/soft-limit.js" => [],
]; ];
@ -61,7 +61,7 @@ function islandora_advanced_search_library_info_alter(&$libraries, $extension) {
/** /**
* Implements hook_search_api_solr_converted_query_alter(). * Implements hook_search_api_solr_converted_query_alter().
*/ */
function islandora_advanced_search_search_api_solr_converted_query_alter(SolariumQueryInterface $solarium_query, DrupalQueryInterface $search_api_query) { function advanced_search_search_api_solr_converted_query_alter(SolariumQueryInterface $solarium_query, DrupalQueryInterface $search_api_query) {
// We must modify the query itself rather than the representation the // We must modify the query itself rather than the representation the
// search_api presents as it is not possible to use the 'OR' operator // search_api presents as it is not possible to use the 'OR' operator
// with it as it converts conditions into separate filter queries. // with it as it converts conditions into separate filter queries.
@ -74,7 +74,7 @@ function islandora_advanced_search_search_api_solr_converted_query_alter(Solariu
/** /**
* Implements hook_form_form_id_alter(). * Implements hook_form_form_id_alter().
*/ */
function islandora_advanced_search_form_block_form_alter(&$form, FormStateInterface $form_state, $form_id) { function advanced_search_form_block_form_alter(&$form, FormStateInterface $form_state, $form_id) {
// Islandora removes this condition from the form, but we require it. // Islandora removes this condition from the form, but we require it.
// So we can show blocks for nodes which belong to specific models. // So we can show blocks for nodes which belong to specific models.
// Allowing us to add a block for collections only. // Allowing us to add a block for collections only.
@ -104,7 +104,7 @@ function islandora_advanced_search_form_block_form_alter(&$form, FormStateInterf
/** /**
* Implements hook_preprocess_block__facets_summary(). * Implements hook_preprocess_block__facets_summary().
*/ */
function islandora_advanced_search_preprocess_block__facets_summary(&$variables) { function advanced_search_preprocess_block__facets_summary(&$variables) {
// Copy data-attributes to the content as the javascript expects // Copy data-attributes to the content as the javascript expects
// there to be no elements between the data declaration and the // there to be no elements between the data declaration and the
// content of the block. // content of the block.
@ -118,7 +118,7 @@ function islandora_advanced_search_preprocess_block__facets_summary(&$variables)
/** /**
* Implements hook_preprocess_preprocess_views_view(). * Implements hook_preprocess_preprocess_views_view().
*/ */
function islandora_advanced_search_preprocess_views_view(&$variables) { function advanced_search_preprocess_views_view(&$variables) {
/** @var \Drupal\views\ViewExecutable $view */ /** @var \Drupal\views\ViewExecutable $view */
$view = &$variables['view']; $view = &$variables['view'];
$views = Utilities::getPagerViewDisplays(); $views = Utilities::getPagerViewDisplays();
@ -128,7 +128,7 @@ function islandora_advanced_search_preprocess_views_view(&$variables) {
// Toggle between 'list' and 'grid' display depending on url parameter. // Toggle between 'list' and 'grid' display depending on url parameter.
$format = \Drupal::request()->query->get('display') ?? 'grid'; $format = \Drupal::request()->query->get('display') ?? 'grid';
$variables['attributes']['class'][] = "view-{$format}"; $variables['attributes']['class'][] = "view-{$format}";
$view->element['#attached']['library'][] = 'islandora_advanced_search/advanced.search.pager'; $view->element['#attached']['library'][] = 'advanced_search/advanced.search.pager';
} }
$view = &$variables['view']; $view = &$variables['view'];
} }
@ -136,7 +136,7 @@ function islandora_advanced_search_preprocess_views_view(&$variables) {
/** /**
* Implements hook_views_pre_view(). * Implements hook_views_pre_view().
*/ */
function islandora_advanced_search_views_pre_view(ViewExecutable $view, $display_id, array &$args) { function advanced_search_views_pre_view(ViewExecutable $view, $display_id, array &$args) {
// Allow for recursive searches by disabling contextual filter. // Allow for recursive searches by disabling contextual filter.
$advanced_search_query = new AdvancedSearchQuery(); $advanced_search_query = new AdvancedSearchQuery();
$advanced_search_query->alterView(\Drupal::request(), $view, $display_id); $advanced_search_query->alterView(\Drupal::request(), $view, $display_id);
@ -145,7 +145,7 @@ function islandora_advanced_search_views_pre_view(ViewExecutable $view, $display
/** /**
* Implements hook_preprocess_facets_summary_item_list(). * Implements hook_preprocess_facets_summary_item_list().
*/ */
function islandora_advanced_search_preprocess_facets_summary_item_list(&$variables) { function advanced_search_preprocess_facets_summary_item_list(&$variables) {
foreach ($variables['items'] as &$item) { foreach ($variables['items'] as &$item) {
$item['attributes']['class'][] = 'facet-summary-item'; $item['attributes']['class'][] = 'facet-summary-item';
} }
@ -154,7 +154,7 @@ function islandora_advanced_search_preprocess_facets_summary_item_list(&$variabl
/** /**
* Implements hook_preprocess_facets_item_list(). * Implements hook_preprocess_facets_item_list().
*/ */
function islandora_advanced_search_preprocess_facets_item_list(&$variables) { function advanced_search_preprocess_facets_item_list(&$variables) {
$widget = $variables['facet']->getWidget(); $widget = $variables['facet']->getWidget();
$soft_limit = $widget['config']['soft_limit']; $soft_limit = $widget['config']['soft_limit'];
// Break into two groups less / more which can display be toggled as a single // Break into two groups less / more which can display be toggled as a single
@ -168,7 +168,7 @@ function islandora_advanced_search_preprocess_facets_item_list(&$variables) {
/** /**
* Implements hook_preprocess_facets_result_item(). * Implements hook_preprocess_facets_result_item().
*/ */
function islandora_advanced_search_preprocess_facets_result_item(&$variables) { function advanced_search_preprocess_facets_result_item(&$variables) {
$settings = \Drupal::config(SettingsForm::CONFIG_NAME); $settings = \Drupal::config(SettingsForm::CONFIG_NAME);
$length = $settings->get(SettingsForm::FACET_TRUNCATE); $length = $settings->get(SettingsForm::FACET_TRUNCATE);
if (is_numeric($length)) { if (is_numeric($length)) {

View file

@ -1,15 +1,15 @@
islandora_advanced_search.ajax.blocks: advanced_search.ajax.blocks:
path: '/islandora-advanced-search-ajax-blocks' path: '/islandora-advanced-search-ajax-blocks'
defaults: defaults:
_controller: '\Drupal\islandora_advanced_search\Controller\AjaxBlocksController::respond' _controller: '\Drupal\advanced_search\Controller\AjaxBlocksController::respond'
requirements: requirements:
# Allow public access to search blocks. # Allow public access to search blocks.
_access: 'TRUE' _access: 'TRUE'
islandora_advanced_search.settings: advanced_search.settings:
path: '/admin/config/search/advanced' path: '/admin/config/search/advanced'
defaults: defaults:
_form: '\Drupal\islandora_advanced_search\Form\SettingsForm' _form: '\Drupal\advanced_search\Form\SettingsForm'
_title: 'Islandora Advanced Search Settings' _title: 'Islandora Advanced Search Settings'
requirements: requirements:
_permission: 'administer site configuration' _permission: 'administer site configuration'

View file

@ -1,8 +1,8 @@
.islandora_advanced_search_result_pager .pager__summary { .advanced_search_result_pager .pager__summary {
font-weight: 700; font-weight: 700;
} }
.islandora_advanced_search_result_pager .pager__group { .advanced_search_result_pager .pager__group {
margin: 1.25rem 0; margin: 1.25rem 0;
padding: 1rem 0; padding: 1rem 0;
border-top: 1px solid; border-top: 1px solid;
@ -15,32 +15,32 @@
} }
@media all and (min-width: 45.063em) { @media all and (min-width: 45.063em) {
.islandora_advanced_search_result_pager .pager__group { .advanced_search_result_pager .pager__group {
justify-content: flex-end; justify-content: flex-end;
} }
.islandora_advanced_search_result_pager .pager__group > * { .advanced_search_result_pager .pager__group > * {
margin: 0.47214rem 0 0.47214rem 2.61803rem; margin: 0.47214rem 0 0.47214rem 2.61803rem;
} }
.islandora_advanced_search_result_pager .pager__group > *:first-child { .advanced_search_result_pager .pager__group > *:first-child {
margin-left: 0; margin-left: 0;
} }
} }
.islandora_advanced_search_result_pager .pager__group > * { .advanced_search_result_pager .pager__group > * {
margin: 0.47214rem 2rem 0.47214rem 0; margin: 0.47214rem 2rem 0.47214rem 0;
} }
.islandora_advanced_search_result_pager .pager__group > *:last-child { .advanced_search_result_pager .pager__group > *:last-child {
margin-right: 0; margin-right: 0;
} }
.islandora_advanced_search_result_pager .pager__group .item-list__list, .advanced_search_result_pager .pager__group .item-list__list,
.islandora_advanced_search_result_pager .pager__group .item-list__title, .advanced_search_result_pager .pager__group .item-list__title,
.islandora_advanced_search_result_pager .pager__group .item-list__item { .advanced_search_result_pager .pager__group .item-list__item {
display: inline; display: inline;
} }
.islandora_advanced_search_result_pager .pager__group .item-list__title { .advanced_search_result_pager .pager__group .item-list__title {
font-size: initial; font-size: initial;
margin: 0.25rem; margin: 0.25rem;
} }
@ -112,16 +112,16 @@
/* generalizing */ /* generalizing */
.islandora_advanced_search_result_pager .pager__group .pager { .advanced_search_result_pager .pager__group .pager {
display: none; display: none;
} }
.islandora_advanced_search_result_pager .pager__group > * { .advanced_search_result_pager .pager__group > * {
margin: 0.47214rem 2rem 0.47214rem 0; margin: 0.47214rem 2rem 0.47214rem 0;
display:flex; display:flex;
} }
.islandora_advanced_search_result_pager .pager__group > *:last-child { .advanced_search_result_pager .pager__group > *:last-child {
margin-right: 0; margin-right: 0;
} }
@ -135,7 +135,7 @@
padding-right: 0 !important; padding-right: 0 !important;
} }
.islandora_advanced_search_result_pager .pager__group nav { .advanced_search_result_pager .pager__group nav {
display: none; display: none;
} }

View file

@ -1,17 +0,0 @@
advanced.search.admin:
js:
js/islandora_advanced_search.admin.js: {}
dependencies:
- core/drupal.tabledrag
advanced.search.form:
js:
js/islandora_advanced_search.form.js: {}
css:
component:
css/islandora_advanced_search.form.css: {}
advanced.search.pager:
css:
component:
css/islandora_advanced_search.pager.css: {}

View file

@ -1,8 +1,8 @@
//# sourceURL=modules/contrib/islandora_advanced_search/js/islandora-advanced-search.admin.js //# sourceURL=modules/contrib/advanced_search/js/islandora-advanced-search.admin.js
/** /**
* @file * @file
* Largely based on core/modules/blocks/js/blocks.js * Largely based on core/modules/blocks/js/blocks.js
* *
* This file allows for moving rows between two regions in a table and have the * This file allows for moving rows between two regions in a table and have the
* 'region' field update appropriately. * 'region' field update appropriately.
*/ */
@ -110,4 +110,4 @@
}); });
} }
}; };
})(jQuery, window, Drupal); })(jQuery, window, Drupal);

View file

@ -1,4 +1,4 @@
//# sourceURL=modules/contrib/islandora/modules/islandora_advanced_search/js/islandora-advanced-search.form.js //# sourceURL=modules/contrib/islandora/modules/advanced_search/js/islandora-advanced-search.form.js
/** /**
* @file * @file
* Handles Ajax submission / updating form action on url change, etc. * Handles Ajax submission / updating form action on url change, etc.
@ -81,10 +81,10 @@
return window.location.href.split("?")[0] + "?" + $.param(params); return window.location.href.split("?")[0] + "?" + $.param(params);
} }
Drupal.behaviors.islandora_advanced_search_form = { Drupal.behaviors.advanced_search_form = {
attach: function (context, settings) { attach: function (context, settings) {
if (settings.islandora_advanced_search_form.id !== 'undefined') { if (settings.advanced_search_form.id !== 'undefined') {
const $form = $('form#' + settings.islandora_advanced_search_form.id).once(); const $form = $('form#' + settings.advanced_search_form.id).once();
if ($form.length > 0) { if ($form.length > 0) {
window.addEventListener("pushstate", function (e) { window.addEventListener("pushstate", function (e) {
$form.attr('action', window.location.pathname + window.location.search); $form.attr('action', window.location.pathname + window.location.search);
@ -96,25 +96,25 @@
}); });
// Prevent form submission and push state instead. // Prevent form submission and push state instead.
// //
// Logic server side / client side should match to generate the // Logic server side / client side should match to generate the
// appropriate URL with javascript enabled or disable. // appropriate URL with javascript enabled or disable.
// //
// If a route is set for the view display that this form is derived // If a route is set for the view display that this form is derived
// from, and we are not on the same page as that route, rely on the // from, and we are not on the same page as that route, rely on the
// normal submit which will redirect to the appropriate page. // normal submit which will redirect to the appropriate page.
if (!settings.islandora_advanced_search_form.redirect) { if (!settings.advanced_search_form.redirect) {
$form.submit(function (e) { $form.submit(function (e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
const inputs = $form.serializeArray(); const inputs = $form.serializeArray();
const href = url(inputs, settings.islandora_advanced_search_form); const href = url(inputs, settings.advanced_search_form);
window.history.pushState(null, document.title, href); window.history.pushState(null, document.title, href);
}); });
} }
// Reset should trigger refresh of AJAX Blocks / Views. // Reset should trigger refresh of AJAX Blocks / Views.
$form.find('input[data-drupal-selector = "edit-reset"]').mousedown(function (e) { $form.find('input[data-drupal-selector = "edit-reset"]').mousedown(function (e) {
const inputs = []; const inputs = [];
const href = url(inputs, settings.islandora_advanced_search_form); const href = url(inputs, settings.advanced_search_form);
window.history.pushState(null, document.title, href); window.history.pushState(null, document.title, href);
}); });
} }

View file

@ -1,4 +1,4 @@
//# sourceURL=modules/contrib/islandora/modules/islandora_advanced_search/js/facets/facets-view.ajax.js //# sourceURL=modules/contrib/islandora/modules/advanced_search/js/facets/facets-view.ajax.js
/** /**
* @file * @file
* Overrides the facets-view-ajax.js behavior from the 'facets' module. * Overrides the facets-view-ajax.js behavior from the 'facets' module.
@ -132,7 +132,7 @@
window.history.pushState(null, document.title, $(this).attr("href")); window.history.pushState(null, document.title, $(this).attr("href"));
}); });
/* digitalutsc added */ /* digitalutsc added */
$('.pager__sort select[name="order"]') $('.pager__sort select[name="order"]')
.once() .once()

View file

@ -1,4 +1,4 @@
//# sourceURL=modules/contrib/islandora/modules/islandora_advanced_search/js/facets/soft-limit.js //# sourceURL=modules/contrib/islandora/modules/advanced_search/js/facets/soft-limit.js
/** /**
* @file * @file
* Overrides the soft-limit.js behavior from the 'facets' module. * Overrides the soft-limit.js behavior from the 'facets' module.

View file

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

View file

@ -1,8 +1,8 @@
<?php <?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. * Defines a single search term.
@ -17,7 +17,7 @@ class AdvancedSearchQueryTerm {
const CONJUNCTION_OR = 'OR'; const CONJUNCTION_OR = 'OR';
// Used for serializing / deserializing query parameters. // 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 CONJUNCTION_QUERY_PARAMETER = 'c';
const FIELD_QUERY_PARAMETER = 'f'; const FIELD_QUERY_PARAMETER = 'f';
const INCLUDE_QUERY_PARAMETER = 'i'; const INCLUDE_QUERY_PARAMETER = 'i';
@ -139,7 +139,7 @@ class AdvancedSearchQueryTerm {
* @param array $params * @param array $params
* An array representing the query parameters for a single search term. * 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. * An object which represents a valid search term.
*/ */
public static function fromQueryParams(array $params) { public static function fromQueryParams(array $params) {
@ -168,7 +168,7 @@ class AdvancedSearchQueryTerm {
* @param array $input * @param array $input
* An array representing the submitted form values for a single search term. * 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. * An object which represents a valid search term.
*/ */
public static function fromUserInput(array $input) { public static function fromUserInput(array $input) {

View file

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

View file

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

View file

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

View file

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

View file

@ -1,8 +1,8 @@
<?php <?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. * Simple trait for accessing this modules configuration.

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
<?php <?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. * Gets the view and display identifiers used to create this block.

View file

@ -1,6 +1,6 @@
<?php <?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\FieldItemListInterface;
use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase; use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase;

View file

@ -1,6 +1,6 @@
<?php <?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\facets\Plugin\facets\widget\LinksWidget;
use Drupal\Core\Link; use Drupal\Core\Link;

View file

@ -1,6 +1,6 @@
<?php <?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\FacetsSummaryInterface;
use Drupal\facets_summary\Processor\BuildProcessorInterface; use Drupal\facets_summary\Processor\BuildProcessorInterface;

View file

@ -1,6 +1,6 @@
<?php <?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\FacetsSummaryInterface;
use Drupal\facets_summary\Processor\BuildProcessorInterface; use Drupal\facets_summary\Processor\BuildProcessorInterface;

View file

@ -1,6 +1,6 @@
<?php <?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\Link;
use Drupal\facets_summary\FacetsSummaryInterface; use Drupal\facets_summary\FacetsSummaryInterface;

View file

@ -1,6 +1,6 @@
<?php <?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\Link;
use Drupal\Core\Url; use Drupal\Core\Url;

View file

@ -1,6 +1,6 @@
<?php <?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\FacetsSummaryInterface;
use Drupal\facets_summary\Processor\BuildProcessorInterface; use Drupal\facets_summary\Processor\BuildProcessorInterface;

View file

@ -1,6 +1,6 @@
<?php <?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\Link;
use Drupal\Core\Url; use Drupal\Core\Url;

View file

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