<?php

/**
 * @file
 * Functions to support theming blocks in the Toc Master theme.
 */

use Drupal\block\Entity\Block;
use Drupal\Core\Template\Attribute;

/**
 * Implements hook_preprocess_HOOK().
 *
 * Pass block region value to content so this can be used in
 * MYTHEME_theme_suggestions_menu_alter.
 */
function toc_wmr_preprocess_block(&$vars) {

  // Hide contextual links from all blocks in the list.
  $blocks_hide_context_links = [
    'footerlogo',
  ];
  $id = $vars['elements']['#id'] ?? '';
  if (in_array($id, $blocks_hide_context_links)) {
    if (!empty($vars['title_suffix']) && !empty($vars['title_suffix']['contextual_links'])) {
      unset($vars['title_suffix']['contextual_links']);
    }
  }
}
