You are here

function views_post_update_exposed_filter_blocks_label_display in Drupal 8

Update exposed filter blocks label display to be disabled.

File

core/modules/views/views.post_update.php, line 343
Post update functions for Views.

Code

function views_post_update_exposed_filter_blocks_label_display(&$sandbox = NULL) {

  // If Block is not installed, there's nothing to do.
  if (!\Drupal::moduleHandler()
    ->moduleExists('block')) {
    return;
  }
  \Drupal::classResolver(ConfigEntityUpdater::class)
    ->update($sandbox, 'block', function ($block) {

    /** @var \Drupal\block\BlockInterface $block */
    if (strpos($block
      ->getPluginId(), 'views_exposed_filter_block:') === 0) {
      $block
        ->getPlugin()
        ->setConfigurationValue('label_display', '0');
      return TRUE;
    }
    return FALSE;
  });
}