reverted:
--- b/core/modules/node/config/install/search.page.node_search.yml
+++ a/core/modules/node/config/install/search.page.node_search.yml
@@ -1,13 +1,12 @@
-langcode: en
-status: true
-dependencies:
- module:
- - node
id: node_search
label: Content
+status: true
+langcode: en
path: node
weight: -10
plugin: node_search
configuration:
rankings: { }
+dependencies:
+ module:
+ - node
-search_help: "
Tips for Content search:
\r\n\r\n- Content search looks for exact, case-insensitive keywords; keywords less than 3 characters long are ignored.
\r\n- Use upper-case OR to get more results. Example: cat OR dog (content contains either \"cat\" or \"dog\").
\r\n- You can use upper-case AND to require all words, but this is the same as the default behavior. Example: cat AND dog (same as cat dog, content must contain both \"cat\" and \"dog\").
\r\n- Use quotes to search for a phrase. Example: \"the cat eats mice\".
\r\n- You can precede keywords by - to exclude them; you must still have at least one \"positive\" keyword. Example: cat -dog (content must contain cat and cannot contain dog).
\r\n
\r\n"
reverted:
--- b/core/modules/search/config/schema/search.schema.yml
+++ a/core/modules/search/config/schema/search.schema.yml
@@ -86,8 +86,5 @@
plugin:
type: string
label: 'Plugin'
- search_help:
- type: string
- label: 'Search help'
configuration:
type: search.plugin.[%parent.plugin]
diff -u b/core/modules/search/src/Controller/SearchController.php b/core/modules/search/src/Controller/SearchController.php
--- b/core/modules/search/src/Controller/SearchController.php
+++ b/core/modules/search/src/Controller/SearchController.php
@@ -7,7 +7,6 @@
namespace Drupal\search\Controller;
-use Drupal\Component\Utility\Xss;
use Drupal\Core\Config\ConfigFactory;
use Drupal\Core\Controller\ControllerBase;
use Drupal\search\SearchPageInterface;
@@ -114,7 +113,6 @@
'#theme' => array('item_list__search_results__' . $plugin->getPluginId(), 'item_list__search_results'),
'#items' => $results,
'#empty' => array(
- // @todo Revisit where this help text is added.
'#markup' => '' . $this->t('Your search yielded no results.') . '
',
),
'#list_type' => 'ol',
@@ -152,9 +150,7 @@
public function searchHelp(SearchPageInterface $entity) {
$build = array();
- $build['search_help'] = array(
- '#markup' => Xss::filterAdmin($entity->get('search_help')),
- );
+ $build['search_help'] = $entity->getPlugin()->getHelp();
return $build;
}
reverted:
--- b/core/modules/search/src/Form/SearchPageFormBase.php
+++ a/core/modules/search/src/Form/SearchPageFormBase.php
@@ -113,14 +113,6 @@
'#default_value' => $this->entity->getPath(),
'#maxlength' => '255',
);
-
- $form['search_help'] = array(
- '#type' => 'textarea',
- '#title' => $this->t('Search help'),
- '#default_value' => $this->entity->get('search_help'),
- '#description' => $this->t('This help is displayed on a separate page linked from the search page. Most HTML tags are allowed.'),
- );
-
$form['plugin'] = array(
'#type' => 'value',
'#value' => $this->entity->get('plugin'),
diff -u b/core/modules/search/src/Tests/SearchPageTextTest.php b/core/modules/search/src/Tests/SearchPageTextTest.php
--- b/core/modules/search/src/Tests/SearchPageTextTest.php
+++ b/core/modules/search/src/Tests/SearchPageTextTest.php
@@ -48,9 +48,8 @@
$this->assertText(t('Content'), 'Tab and breadcrumb text is present');
$this->clickLink('Search help');
- $this->assertText(t('Search help'), 'Correct title is on search help page');
- $this->assertText(t('Tips for Content search'), 'Correct header is on content search help page');
- $this->assertText(t('Use upper-case OR to get more results'), 'Correct text is on content search help page');
+ $this->assertText('Search help', 'Correct title is on search help page');
+ $this->assertText('Use upper-case OR to get more results', 'Correct text is on content search help page');
// Search for a longer text, and see that it is in the title, truncated.
$edit = array();
@@ -72,9 +71,8 @@
$this->assertTitle(t($title_source, array('@keywords' => Unicode::truncate($this->searching_user->getUsername(), 60, TRUE, TRUE))));
$this->clickLink('Search help');
- $this->assertText(t('Search help'), 'Correct title is on search help page');
- $this->assertText(t('Tips for User search'), 'Correct header is on user search help page');
- $this->assertText(t('user names and partial user names'), 'Correct text is on user search help page');
+ $this->assertText('Search help', 'Correct title is on search help page');
+ $this->assertText('user names and partial user names', 'Correct text is on user search help page');
// Test that search keywords containing slashes are correctly loaded
// from the GET params and displayed in the search form.
reverted:
--- b/core/modules/user/config/install/search.page.user_search.yml
+++ a/core/modules/user/config/install/search.page.user_search.yml
@@ -1,12 +1,10 @@
-langcode: en
-status: true
-dependencies:
- module:
- - user
id: user_search
label: Users
+status: true
+langcode: en
path: user
-weight: 0
plugin: user_search
configuration: { }
+dependencies:
+ module:
+ - user
-search_help: "Tips for User search:
\r\n\r\n- User search looks for user names and partial user names. Example: mar would match usernames mar, delmar, and maryjane.
\r\n- You can use * as a wildcard within your keyword. Example: m*r would also match user names mar, delmar, and maryjane.
\r\n
\r\n"
only in patch2:
unchanged:
--- a/core/modules/search/src/Plugin/SearchInterface.php
+++ b/core/modules/search/src/Plugin/SearchInterface.php
@@ -91,6 +91,14 @@ public function buildResults();
public function suggestedTitle();
/**
+ * Returns the searching help.
+ *
+ * @return array
+ * Render array for the searching help.
+ */
+ public function getHelp();
+
+ /**
* Alters the search form when being built for a given plugin.
*
* The core search module only invokes this method on active module plugins
only in patch2:
unchanged:
--- a/core/modules/search/src/Plugin/SearchPluginBase.php
+++ b/core/modules/search/src/Plugin/SearchPluginBase.php
@@ -133,4 +133,25 @@ public function buildSearchUrlQuery(FormStateInterface $form_state) {
return $query;
}
+
+ /*
+ * {@inheritdoc}
+ */
+ public function getHelp() {
+ // This default search help is appropriate for plugins like NodeSearch
+ // that use the SearchQuery class.
+ $help = array('list' => array(
+ '#theme' => 'item_list',
+ '#items' => array(
+ $this->t('Search looks for exact, case-insensitive keywords; keywords shorter than a minimum length are ignored.'),
+ $this->t('Use upper-case OR to get more results. Example: cat OR dog (content contains either "cat" or "dog").'),
+ $this->t('You can use upper-case AND to require all words, but this is the same as the default behavior. Example: cat AND dog (same as cat dog, content must contain both "cat" and "dog").'),
+ $this->t('Use quotes to search for a phrase. Example: "the cat eats mice".'),
+ $this->t('You can precede keywords by - to exclude them; you must still have at least one "positive" keyword. Example: cat -dog (content must contain cat and cannot contain dog).'),
+ ),
+ ));
+
+ return $help;
+ }
+
}
only in patch2:
unchanged:
--- a/core/modules/user/src/Plugin/Search/UserSearch.php
+++ b/core/modules/user/src/Plugin/Search/UserSearch.php
@@ -160,4 +160,19 @@ public function execute() {
return $results;
}
+ /*
+ * {@inheritdoc}
+ */
+ public function getHelp() {
+ $help = array('list' => array(
+ '#theme' => 'item_list',
+ '#items' => array(
+ $this->t('User search looks for user names and partial user names. Example: mar would match usernames mar, delmar, and maryjane.'),
+ $this->t('You can use * as a wildcard within your keyword. Example: m*r would match user names mar, delmar, and elementary.'),
+ ),
+ ));
+
+ return $help;
+ }
+
}