Skip to content

fix(quant_search): remove a deleted search page's search box, and repair one left behind - #268

Open
stooit wants to merge 1 commit into
2.xfrom
fix/search-block-orphan
Open

stooit wants to merge 1 commit into
2.xfrom
fix/search-block-orphan

Conversation

@stooit

@stooit stooit commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Problem

Deleting a Quant search page left its autocomplete block in the theme. When the page was created again, placeBlock() found the block by its ID and kept it, still pointing at the deleted page's UUID. Every page then logged:

Quant search block is missing its corresponding search page.

and showed no header search box. The create form also counted the orphaned box ("This theme already has a Quant search box") and did not tick "Add a search box".

Seen on the Tolmerra demo site on 10 Nov 2026 after deleting and re-creating /site-search with 2.3.0.

Fix

  • quant_search_quant_search_page_delete() deletes the autocomplete blocks whose page setting is the deleted page's UUID.
  • The create form counts only search boxes whose page exists.
  • placeBlock(): if a block with the same ID exists but its page does not, it points that block at the new page. This repairs sites that are already in that state.

Tests

CreateSearchPageTest (functional):

  • testDeletingThePageRemovesItsSearchBox: the block goes with the page, and the next create form proposes a box again.
  • testStaleSearchBoxIsRepointed: an orphaned block (old UUID) does not count as a box, and creating the page points it at the new page.

Both failed on 2.x before the fix: the block remained after the delete, and "place block" was unticked because of the orphaned box. Results with the fix:

  • CreateSearchPageTest: 7/7 pass (87 assertions).
  • quant_search kernel tests: 5/5 pass.
  • quant_search unit tests: 9/9 pass.
  • phpcs --standard=Drupal on modules/quant_search: clean.

…air one left behind

Deleting a search page left its autocomplete block in the theme. Creating the
page again kept that block, which still pointed at the deleted page's UUID, so
every page logged "Quant search block is missing its corresponding search
page." and showed no header search box. The create form also counted the
orphaned box and did not propose a new one.

- hook_quant_search_page_delete() deletes the autocomplete blocks of the page.
- The create form counts only search boxes whose page exists.
- placeBlock() points a block of the same ID that a deleted page left behind
  at the new page (repairs sites that are already in that state).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant