Problem/Motivation
Over in #2664830-213: Add search capability to help topics we discovered that search blocks don't have a dependency on the search page they submit to. This can cause problems when uninstalling modules.
Steps to reproduce:
a) Create and place a search form block that connects to a particular type of search page provided by a module that you can uninstall later, such as Help search if #2664830: Add search capability to help topics is installed and Help Topics module is turned on (or a testing module's page if you are writing a test). Visit the page where the block is placed and verify you can submit the search form.
b) Uninstall the module that provides the search page.
c) Visit the page with the block on it. You will get a White Screen of Death due to a routing exception, saying the route to the search page cannot be found.
Proposed resolution
Fix the plugin class to add the correct dependencies. This should make the block get deleted as part of the module uninstall.
Remaining tasks
Make a patch, including a test.
User interface changes
Search Form blocks connected to particular Search pages will be deleted when the search page is deleted, such as when the providing module is uninstalled.
API changes
None.
Data model changes
Search Form blocks will have a dependency on the configured search page.
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | 3086824-nr-bot.txt | 144 bytes | needs-review-queue-bot |
| #29 | 3086824-29.patch | 7.8 KB | andypost |
| #29 | interdiff.txt | 2.74 KB | andypost |
| #28 | interdiff.txt | 2.11 KB | andypost |
Comments
Comment #2
alexpottHere's a start on this. It's a shame that the search page repository can't load a page by an ID given that that is already injected.
Comment #3
andypostFix "deprecation dance"
Comment #4
jhodgdonFilling out the issue summary.
However... There is another aspect to this problem, which is that you can also *disable* a search page from admin/search/pages. This I think will also trigger the WSOD. However, it will not be fixed by just adding this dependency.
Comment #5
jhodgdonI think this is related
Comment #6
jhodgdonActually I am pretty sure this issue is a duplicate of the other one. And the title is wrong -- the title is about the proposed fix, not about the actual bug, which is that the Search Form Block doesn't verify that the search page it would want to submit to actually exists and is currently enabled.
Comment #7
jhodgdonRE #4, that part is now a separate issue #3086846: Deprecate ability to disable search pages (no reason for it and causes problems and code complexity), so the issue summary here is OK.
Comment #8
alexpottAdding a test and an update path. Now we need an update path test.
Comment #9
andypostComment #10
andypostHere goes upgrade test, looks if no search page configured it must add dependency on search settings (default page)
Comment #11
andypostUmami and standard's profile blocks use to define search page so added their dependencies
Comment #12
alexpottIt's odd that \Drupal\FunctionalTests\Installer\StandardInstallerTest::testStandardConfig() didn't catch this. It's also odd that page_id is set in Standard. FYI the search_post_update_block_page() will not update existing Standard installs.
Comment #13
andypostPatch fixing and one more block
@alexpott that's supposed behaviour - block can set "empty" to point to use default page from settings, see
\Drupal\search\Form\SearchBlockForm::buildForm()starting linesThat makes a question - if default configured ...isn't it the blocks with "" should depends on config
search.settings, see\Drupal\search\SearchPageRepository::getDefaultSearchPage()Comment #14
alexpottI think the patch is going to fail because this patch on HEAD generates a \Drupal\Core\Config\UnmetDependenciesException() when installing standard. Which is interesting because #2922417: Profile provided configuration entities can have unmeetable dependencies was supposed to have solved this :(
Comment #15
alexpottAh I see. So this isn't really caused by #2922417: Profile provided configuration entities can have unmeetable dependencies the unmet dependency fail also occurs on commit hash bd5908ad2e - which is the commit prior to 2922417 going in (phew). The problem is that search.page.node is optional configuration in the node module and is only installed when the optional config for install profile is installed - which is after the config/install config for Standard is installed. SO we have 2 options:
Comment #16
andypostMoved to optional
Comment #17
alexpottThere's a third interesting option. In
install_install_profile()we could install all available optional config both before and after the installation of the profile. This allows profile configuration to depend upon optional configuration provided by the modules it installs.Comment #20
andypostHere's testing patch - calling install optional config before profile install and blocks moved back
Comment #22
alexpottOpened #3087130: Profile configuration should be able to depend on optional configuration provided by modules = the fail in #20 is valid we need to update the help topic config to move the dependency out of enforced.
Comment #23
andypostFixed "enforced" looks this one should be postponed on #3087130: Profile configuration should be able to depend on optional configuration provided by modules
Comment #28
andypostRe-roll for 9.3, tests added
Comment #29
andypostFix post update hook to prevent Olivero's blocks from update and polishing
Comment #33
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #36
quietone commentedThe Search Module was approved for removal in #3476883: [Policy, no patch] Move Search module to contrib .
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3565780: [meta] Tasks to deprecate the Search module and the removal work in #3565783: [meta] Tasks to remove the Search module.
Search will be moved to a contributed project before Drupal 12.0.0 is released.
Comment #37
quietone commentedThe Search Module has moved from core to contrib,