Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to disable Recursive search in Advanced Search Block #6

Open
kylehuynh205 opened this issue Mar 13, 2024 · 1 comment
Open
Labels
good first issue Good for newcomers

Comments

@kylehuynh205
Copy link

How to reproduce

  • Add a Advanced Search Form Block, Select an option of Context Filter:
    image

  • Save the block

  • Open the block configuration again, try to unselect the selected option in Context Filter dropdown, but it's impossible to do that

Diagnosis

  • To be able to unselect the Context filter, change "#multiple => TRUE" at this line, However, the Advanced Search block is not rendered because of this error:
TypeError: Drupal\advanced_search\Form\AdvancedSearchForm::buildForm(): Argument #6 ($context_filter) must be of type ?string, array given in Drupal\advanced_search\Form\AdvancedSearchForm->buildForm() (line 254 of /var/www/D10-doris/web/modules/contrib/advanced_search/src/Form/AdvancedSearchForm.php)
#0 [internal function]: Drupal\advanced_search\Form\AdvancedSearchForm->buildForm()
#1 /var/www/D10-doris/web/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array()
#2 /var/www/D10-doris/web/core/lib/Drupal/Core/Form/FormBuilder.php(283): Drupal\Core\Form\FormBuilder->retrieveForm()
#3 /var/www/D10-doris/web/core/lib/Drupal/Core/Form/FormBuilder.php(224): Drupal\Core\Form\FormBuilder->buildForm()
#4 /var/www/D10-doris/web/modules/contrib/advanced_search/src/Plugin/Block/AdvancedSearchBlock.php(377): Drupal\Core\Form\FormBuilder->getForm()
#5 /var/www/D10-doris/web/core/modules/block/src/BlockViewBuilder.php(171): Drupal\advanced_search\Plugin\Block\AdvancedSearchBlock->build()
#6 [internal function]: Drupal\block\BlockViewBuilder::preRender()
#7 /var/www/D10-doris/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(111): call_user_func_array()
#8 /var/www/D10-doris/web/core/lib/Drupal/Core/Render/Renderer.php(858): Drupal\Core\Render\Renderer->doTrustedCallback()
#9 /var/www/D10-doris/web/core/lib/Drupal/Core/Render/Renderer.php(421): Drupal\Core\Render\Renderer->doCallback()
#10 /var/www/D10-doris/web/core/lib/Drupal/Core/Render/Renderer.php(240): Drupal\Core\Render\Renderer->doRender()
#11 /var/www/D10-doris/web/core/lib/Drupal/Core/Render/Renderer.php(165): Drupal\Core\Render\Renderer->render()
#12 /var/www/D10-doris/web/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#13 /var/www/D10-doris/web/core/lib/Drupal/Core/Render/Renderer.php(166): Drupal\Core\Render\Renderer->executeInRenderContext()
#14 /var/www/D10-doris/web/core/lib/Drupal/Core/Render/Renderer.php(183): Drupal\Core\Render\Renderer->renderPlain()
#15 /var/www/D10-doris/web/core/lib/Drupal/Core/Render/Renderer.php(220): Drupal\Core\Render\Renderer->doRenderPlaceholder()
#16 /var/www/D10-doris/web/core/modules/big_pipe/src/Render/BigPipe.php(723): Drupal\Core\Render\Renderer->renderPlaceholder()
#17 /var/www/D10-doris/web/core/modules/big_pipe/src/Render/BigPipe.php(554): Drupal\big_pipe\Render\BigPipe->renderPlaceholder()
#18 [internal function]: Drupal\big_pipe\Render\BigPipe->Drupal\big_pipe\Render\{closure}()
#19 /var/www/D10-doris/web/core/modules/big_pipe/src/Render/BigPipe.php(566): Fiber->start()
#20 /var/www/D10-doris/web/core/modules/big_pipe/src/Render/BigPipe.php(305): Drupal\big_pipe\Render\BigPipe->sendPlaceholders()
#21 /var/www/D10-doris/web/core/modules/big_pipe/src/Render/BigPipeResponse.php(112): Drupal\big_pipe\Render\BigPipe->sendContent()
#22 /var/www/D10-doris/vendor/symfony/http-foundation/Response.php(425): Drupal\big_pipe\Render\BigPipeResponse->sendContent()
#23 /var/www/D10-doris/web/index.php(20): Symfony\Component\HttpFoundation\Response->send()
#24 {main}

  • the Context Filter of Advanced Search block is saved as as array context_filter: {} instead of string:
uuid: b5911555-37bb-4eef-9d36-4db5b4d54a91
langcode: en
status: true
dependencies:
  module:
    - advanced_search
    - term_condition
  theme:
    - barriodepartments
id: barriodepartments_advancedsearchforcollectionmembers
theme: barriodepartments
region: sidebar_first
weight: -11
provider: null
plugin: 'advanced_search_block:advanced_search__block_1'
settings:
  id: 'advanced_search_block:advanced_search__block_1'
  label: 'Advanced Search: Advanced Search for Collection Members'
  label_display: '0'
  provider: advanced_search
  fields:
    - fulltext_title
    - field_description
    - genre_full_text
    - subject_full_text
    - field_edtf_date_created
  context_filter: {}
visibility:
  term:
    id: term
    negate: false
    context_mapping: {  }
    term_uuids:
      - 6d559ff0-ebbb-4338-a47c-cbec82e822bb

@gerbie-goober
Copy link

PR made to disable subcollection search: #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: No status
Development

No branches or pull requests

2 participants