diff --git a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php index 04cb30b..2cdd7f0 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php @@ -538,7 +538,7 @@ protected function getRankings() { */ public function defaultConfiguration() { $configuration = array( - 'rankings' => array(), + 'rankings' => array(), ); foreach ($this->getRankings() as $var => $value) { $configuration['rankings'][$var] = 0; diff --git a/core/modules/search/lib/Drupal/search/Form/SearchPageFormBase.php b/core/modules/search/lib/Drupal/search/Form/SearchPageFormBase.php index 225a55a..1e574c3 100644 --- a/core/modules/search/lib/Drupal/search/Form/SearchPageFormBase.php +++ b/core/modules/search/lib/Drupal/search/Form/SearchPageFormBase.php @@ -193,4 +193,15 @@ public function delete(array $form, array &$form_state) { ); } + /** + * {@inheritdoc} + */ + protected function actions(array $form, array &$form_state) { + $actions = parent::actions($form, $form_state); + if ($this->entity->isDefaultSearch()) { + unset($actions['delete']); + } + return $actions; + } + } diff --git a/core/modules/search/lib/Drupal/search/Plugin/ConfigurableSearchPluginBase.php b/core/modules/search/lib/Drupal/search/Plugin/ConfigurableSearchPluginBase.php index 8ac2511..0328915 100644 --- a/core/modules/search/lib/Drupal/search/Plugin/ConfigurableSearchPluginBase.php +++ b/core/modules/search/lib/Drupal/search/Plugin/ConfigurableSearchPluginBase.php @@ -7,6 +7,8 @@ namespace Drupal\search\Plugin; +use Drupal\Component\Utility\NestedArray; + /** * Provides a base implementation for a configurable Search plugin. */ @@ -25,7 +27,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_definition) { parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->configuration += $this->defaultConfiguration(); + $this->configuration = NestedArray::mergeDeep($this->defaultConfiguration(), $this->configuration); } /** diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php index aa4d925..0cff49d 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php @@ -110,7 +110,7 @@ function testSearchModuleSettingsPage() { $this->drupalPostForm(NULL, $edit, t('Save search page')); // Ensure that the modifications took effect. - $this->assertText(t('search page has been updated.')); + $this->assertRaw(t('The %label search page has been updated.', array('%label' => 'Dummy search type'))); $this->drupalGet('admin/config/search/settings/manage/dummy_search_type'); $this->assertTrue($this->xpath('//select[@id="edit-extra-type-settings-boost"]//option[@value="ii" and @selected="selected"]'), 'Module specific settings can be changed'); } @@ -232,7 +232,7 @@ public function testMultipleSearchPages() { $first['path'] = strtolower($this->randomName(8)); $this->drupalPostForm(NULL, $first, t('Add search page')); $this->assertDefaultSearch($first_id, 'The default page matches the only search page.'); - $this->assertText(t('The %label search page has been added.', array('%label' => $first['label']))); + $this->assertRaw(t('The %label search page has been added.', array('%label' => $first['label']))); // Attempt to add a search page with an existing path. $edit = array(); @@ -243,7 +243,7 @@ public function testMultipleSearchPages() { $edit['id'] = strtolower($this->randomName(8)); $edit['path'] = $first['path']; $this->drupalPostForm(NULL, $edit, t('Add search page')); - $this->assertText(t('The search path must be unique.')); + $this->assertText(t('The search page path must be unique.')); // Add a second search page. $second = array(); @@ -296,9 +296,9 @@ public function testMultipleSearchPages() { // Test deleting. $this->clickLink(t('Delete')); - $this->assertRaw(t('Are you sure you want to delete the %label search?', array('%label' => $first['label']))); + $this->assertRaw(t('Are you sure you want to delete the %label search page?', array('%label' => $first['label']))); $this->drupalPostForm(NULL, array(), t('Delete')); - $this->assertRaw(t('The %label search has been deleted.', array('%label' => $first['label']))); + $this->assertRaw(t('The %label search page has been deleted.', array('%label' => $first['label']))); $this->verifySearchPageOperations($first_id, FALSE, FALSE, FALSE, FALSE); } diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php index 09a6c2e..cc9da27 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php @@ -118,17 +118,17 @@ public function testRankings() { // Check that all rankings are visible and set to 0. foreach ($node_ranks as $node_rank) { - $this->assertTrue($this->xpath('//select[@id="edit-node-rank-' . $node_rank . '"]//option[@value="0"]'), 'Select list to prioritize ' . $node_rank . ' for node ranks is visible and set to 0.'); + $this->assertTrue($this->xpath('//select[@id="edit-rankings-' . $node_rank . '"]//option[@value="0"]'), 'Select list to prioritize ' . $node_rank . ' for node ranks is visible and set to 0.'); } // Test each of the possible rankings. $edit = array(); foreach ($node_ranks as $node_rank) { // Enable the ranking we are testing. - $edit['node_rank_' . $node_rank] = 10; + $edit['rankings_' . $node_rank] = 10; $this->drupalPostForm('admin/config/search/settings/manage/node_search', $edit, t('Save search page')); $this->drupalGet('admin/config/search/settings/manage/node_search'); - $this->assertTrue($this->xpath('//select[@id="edit-node-rank-' . $node_rank . '"]//option[@value="10"]'), 'Select list to prioritize ' . $node_rank . ' for node ranks is visible and set to 10.'); + $this->assertTrue($this->xpath('//select[@id="edit-rankings-' . $node_rank . '"]//option[@value="10"]'), 'Select list to prioritize ' . $node_rank . ' for node ranks is visible and set to 10.'); // Reload the plugin to get the up-to-date values. $this->nodeSearch = entity_load('search_page', 'node_search'); @@ -137,7 +137,7 @@ public function testRankings() { $set = $this->nodeSearch->getPlugin()->execute(); $this->assertEqual($set[0]['node']->id(), $nodes[$node_rank][1]->id(), 'Search ranking "' . $node_rank . '" order.'); // Clear this ranking for the next test. - $edit['node_rank_' . $node_rank] = 0; + $edit['rankings_' . $node_rank] = 0; } // Save the final node_rank change then check that all rankings are visible @@ -145,7 +145,7 @@ public function testRankings() { $this->drupalPostForm('admin/config/search/settings/manage/node_search', $edit, t('Save search page')); $this->drupalGet('admin/config/search/settings/manage/node_search'); foreach ($node_ranks as $node_rank) { - $this->assertTrue($this->xpath('//select[@id="edit-node-rank-' . $node_rank . '"]//option[@value="0"]'), 'Select list to prioritize ' . $node_rank . ' for node ranks is visible and set to 0.'); + $this->assertTrue($this->xpath('//select[@id="edit-rankings-' . $node_rank . '"]//option[@value="0"]'), 'Select list to prioritize ' . $node_rank . ' for node ranks is visible and set to 0.'); } } @@ -260,7 +260,7 @@ function testDoubleRankings() { $configuration = $this->nodeSearch->getPlugin()->getConfiguration(); foreach ($node_ranks as $var) { $value = ($var == 'sticky' || $var == 'comments') ? 10 : 0; - $configuration["node_rank_$var"] = $value; + $configuration['rankings'][$var] = $value; } $this->nodeSearch->getPlugin()->setConfiguration($configuration); $this->nodeSearch->save();