You are here

function search_post_update_block_page in Drupal 8

Configures default search page for instantiated blocks.

File

core/modules/search/search.post_update.php, line 14
Post update functions for Search module.

Code

function search_post_update_block_page(&$sandbox = NULL) {
  if (!\Drupal::moduleHandler()
    ->moduleExists('block')) {

    // Early exit when block module disabled.
    return;
  }
  \Drupal::classResolver(ConfigEntityUpdater::class)
    ->update($sandbox, 'block', function (BlockInterface $block) {

    // Save search block to set default search page from plugin.
    return $block
      ->getPluginId() === 'search_form_block';
  });
}