Renamed the module's machine name from islandora_advanced_search to `advanced_search
This commit is contained in:
parent
c210ee062c
commit
a3cca6bc37
36 changed files with 130 additions and 130 deletions
|
|
@ -41,7 +41,7 @@ composer require drupal/search_api_solr "^4.1"
|
|||
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:
|
||||
|
||||
- [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
|
||||
composer require islandora/islandora
|
||||
drush en islandora_advanced_search
|
||||
drush en advanced_search
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
|
@ -61,7 +61,7 @@ drush en islandora_advanced_search
|
|||
You can set the following configuration at
|
||||
`admin/config/islandora/advanced_search`:
|
||||
|
||||

|
||||

|
||||
|
||||
## Configuring Solr
|
||||
|
||||
|
|
|
|||
17
advanced_search.libraries.yml
Normal file
17
advanced_search.libraries.yml
Normal 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: {}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
islandora_advanced_search.settings:
|
||||
advanced_search.settings:
|
||||
title: 'Advanced Search Settings'
|
||||
route_name: islandora_advanced_search.settings
|
||||
route_name: advanced_search.settings
|
||||
description: 'Configure Islandora Advanced Search settings'
|
||||
parent: system.admin_config_islandora
|
||||
weight: 99
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains islandora_advanced_search.module.
|
||||
* Contains advanced_search.module.
|
||||
*
|
||||
* This file is part of the Islandora Project.
|
||||
*
|
||||
|
|
@ -15,9 +15,9 @@
|
|||
use Drupal\block\Entity\Block;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\islandora_advanced_search\AdvancedSearchQuery;
|
||||
use Drupal\islandora_advanced_search\Form\SettingsForm;
|
||||
use Drupal\islandora_advanced_search\Utilities;
|
||||
use Drupal\advanced_search\AdvancedSearchQuery;
|
||||
use Drupal\advanced_search\Form\SettingsForm;
|
||||
use Drupal\advanced_search\Utilities;
|
||||
use Drupal\search_api\Query\QueryInterface as DrupalQueryInterface;
|
||||
use Drupal\views\ViewExecutable;
|
||||
use Solarium\Core\Query\QueryInterface as SolariumQueryInterface;
|
||||
|
|
@ -25,7 +25,7 @@ use Solarium\Core\Query\QueryInterface as SolariumQueryInterface;
|
|||
/**
|
||||
* Implements hook_theme().
|
||||
*/
|
||||
function islandora_advanced_search_theme() {
|
||||
function advanced_search_theme() {
|
||||
return [
|
||||
'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().
|
||||
*/
|
||||
function islandora_advanced_search_library_info_alter(&$libraries, $extension) {
|
||||
function advanced_search_library_info_alter(&$libraries, $extension) {
|
||||
if ($extension == 'facets') {
|
||||
// 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'] = [
|
||||
"$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().
|
||||
*/
|
||||
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
|
||||
// search_api presents as it is not possible to use the 'OR' operator
|
||||
// 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().
|
||||
*/
|
||||
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.
|
||||
// So we can show blocks for nodes which belong to specific models.
|
||||
// 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().
|
||||
*/
|
||||
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
|
||||
// there to be no elements between the data declaration and the
|
||||
// content of the block.
|
||||
|
|
@ -118,7 +118,7 @@ function islandora_advanced_search_preprocess_block__facets_summary(&$variables)
|
|||
/**
|
||||
* 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 */
|
||||
$view = &$variables['view'];
|
||||
$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.
|
||||
$format = \Drupal::request()->query->get('display') ?? 'grid';
|
||||
$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'];
|
||||
}
|
||||
|
|
@ -136,7 +136,7 @@ function islandora_advanced_search_preprocess_views_view(&$variables) {
|
|||
/**
|
||||
* 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.
|
||||
$advanced_search_query = new AdvancedSearchQuery();
|
||||
$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().
|
||||
*/
|
||||
function islandora_advanced_search_preprocess_facets_summary_item_list(&$variables) {
|
||||
function advanced_search_preprocess_facets_summary_item_list(&$variables) {
|
||||
foreach ($variables['items'] as &$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().
|
||||
*/
|
||||
function islandora_advanced_search_preprocess_facets_item_list(&$variables) {
|
||||
function advanced_search_preprocess_facets_item_list(&$variables) {
|
||||
$widget = $variables['facet']->getWidget();
|
||||
$soft_limit = $widget['config']['soft_limit'];
|
||||
// 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().
|
||||
*/
|
||||
function islandora_advanced_search_preprocess_facets_result_item(&$variables) {
|
||||
function advanced_search_preprocess_facets_result_item(&$variables) {
|
||||
$settings = \Drupal::config(SettingsForm::CONFIG_NAME);
|
||||
$length = $settings->get(SettingsForm::FACET_TRUNCATE);
|
||||
if (is_numeric($length)) {
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
islandora_advanced_search.ajax.blocks:
|
||||
advanced_search.ajax.blocks:
|
||||
path: '/islandora-advanced-search-ajax-blocks'
|
||||
defaults:
|
||||
_controller: '\Drupal\islandora_advanced_search\Controller\AjaxBlocksController::respond'
|
||||
_controller: '\Drupal\advanced_search\Controller\AjaxBlocksController::respond'
|
||||
requirements:
|
||||
# Allow public access to search blocks.
|
||||
_access: 'TRUE'
|
||||
|
||||
islandora_advanced_search.settings:
|
||||
advanced_search.settings:
|
||||
path: '/admin/config/search/advanced'
|
||||
defaults:
|
||||
_form: '\Drupal\islandora_advanced_search\Form\SettingsForm'
|
||||
_form: '\Drupal\advanced_search\Form\SettingsForm'
|
||||
_title: 'Islandora Advanced Search Settings'
|
||||
requirements:
|
||||
_permission: 'administer site configuration'
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
.islandora_advanced_search_result_pager .pager__summary {
|
||||
.advanced_search_result_pager .pager__summary {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.islandora_advanced_search_result_pager .pager__group {
|
||||
.advanced_search_result_pager .pager__group {
|
||||
margin: 1.25rem 0;
|
||||
padding: 1rem 0;
|
||||
border-top: 1px solid;
|
||||
|
|
@ -15,32 +15,32 @@
|
|||
}
|
||||
|
||||
@media all and (min-width: 45.063em) {
|
||||
.islandora_advanced_search_result_pager .pager__group {
|
||||
.advanced_search_result_pager .pager__group {
|
||||
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;
|
||||
}
|
||||
.islandora_advanced_search_result_pager .pager__group > *:first-child {
|
||||
.advanced_search_result_pager .pager__group > *:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.islandora_advanced_search_result_pager .pager__group > * {
|
||||
.advanced_search_result_pager .pager__group > * {
|
||||
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;
|
||||
}
|
||||
|
||||
.islandora_advanced_search_result_pager .pager__group .item-list__list,
|
||||
.islandora_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__list,
|
||||
.advanced_search_result_pager .pager__group .item-list__title,
|
||||
.advanced_search_result_pager .pager__group .item-list__item {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.islandora_advanced_search_result_pager .pager__group .item-list__title {
|
||||
.advanced_search_result_pager .pager__group .item-list__title {
|
||||
font-size: initial;
|
||||
margin: 0.25rem;
|
||||
}
|
||||
|
|
@ -112,16 +112,16 @@
|
|||
|
||||
|
||||
/* generalizing */
|
||||
.islandora_advanced_search_result_pager .pager__group .pager {
|
||||
.advanced_search_result_pager .pager__group .pager {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.islandora_advanced_search_result_pager .pager__group > * {
|
||||
.advanced_search_result_pager .pager__group > * {
|
||||
margin: 0.47214rem 2rem 0.47214rem 0;
|
||||
display:flex;
|
||||
}
|
||||
|
||||
.islandora_advanced_search_result_pager .pager__group > *:last-child {
|
||||
.advanced_search_result_pager .pager__group > *:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +135,7 @@
|
|||
padding-right: 0 !important;
|
||||
}
|
||||
|
||||
.islandora_advanced_search_result_pager .pager__group nav {
|
||||
.advanced_search_result_pager .pager__group nav {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
|
@ -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: {}
|
||||
|
|
@ -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
|
||||
* Largely based on core/modules/blocks/js/blocks.js
|
||||
*
|
||||
*
|
||||
* This file allows for moving rows between two regions in a table and have the
|
||||
* 'region' field update appropriately.
|
||||
*/
|
||||
|
|
@ -110,4 +110,4 @@
|
|||
});
|
||||
}
|
||||
};
|
||||
})(jQuery, window, Drupal);
|
||||
})(jQuery, window, Drupal);
|
||||
|
|
@ -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
|
||||
* Handles Ajax submission / updating form action on url change, etc.
|
||||
|
|
@ -81,10 +81,10 @@
|
|||
return window.location.href.split("?")[0] + "?" + $.param(params);
|
||||
}
|
||||
|
||||
Drupal.behaviors.islandora_advanced_search_form = {
|
||||
Drupal.behaviors.advanced_search_form = {
|
||||
attach: function (context, settings) {
|
||||
if (settings.islandora_advanced_search_form.id !== 'undefined') {
|
||||
const $form = $('form#' + settings.islandora_advanced_search_form.id).once();
|
||||
if (settings.advanced_search_form.id !== 'undefined') {
|
||||
const $form = $('form#' + settings.advanced_search_form.id).once();
|
||||
if ($form.length > 0) {
|
||||
window.addEventListener("pushstate", function (e) {
|
||||
$form.attr('action', window.location.pathname + window.location.search);
|
||||
|
|
@ -96,25 +96,25 @@
|
|||
});
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
// normal submit which will redirect to the appropriate page.
|
||||
if (!settings.islandora_advanced_search_form.redirect) {
|
||||
// normal submit which will redirect to the appropriate page.
|
||||
if (!settings.advanced_search_form.redirect) {
|
||||
$form.submit(function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
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);
|
||||
});
|
||||
}
|
||||
// Reset should trigger refresh of AJAX Blocks / Views.
|
||||
$form.find('input[data-drupal-selector = "edit-reset"]').mousedown(function (e) {
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
|
@ -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
|
||||
* Overrides the facets-view-ajax.js behavior from the 'facets' module.
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
|
||||
window.history.pushState(null, document.title, $(this).attr("href"));
|
||||
});
|
||||
|
||||
|
||||
/* digitalutsc added */
|
||||
$('.pager__sort select[name="order"]')
|
||||
.once()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* Overrides the soft-limit.js behavior from the 'facets' module.
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\islandora_advanced_search\Form;
|
||||
namespace Drupal\advanced_search\Form;
|
||||
|
||||
|
||||
use Drupal\Core\Form\FormBase;
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\islandora_advanced_search\Plugin\Block;
|
||||
namespace Drupal\advanced_search\Plugin\Block;
|
||||
|
||||
/**
|
||||
* Deriver for AdvancedSearchBlock.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue