# Region alter

```php
/**
 * Implements hook_theme_suggestions_region_alter().
 */
function dev_patterns_theme_suggestions_region_alter(&$suggestions, $vars, $hook) {
  // Define a var for the #region.
  $region = $vars['elements']['#region'];
  // Global reset for all regions.
  $suggestions[] = 'region' . '__' . 'all';

  // Check for any of the three footer regions and create a theme hook.
  if ($region === 'footer' || $region === 'footer_left' || $region === 'footer_right') {
    $suggestions[] = 'region' . '__' . 'footer_all';
  }

  // Check for any of the three header regions and create a theme hook.
  if ($region === 'header_nav' || $region === 'header_utility' || $region === 'header_off_canvas') {
    $suggestions[] = 'region' . '__' . 'header_all';
  }
}
```

�


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://danny-englander.gitbook.io/dev-patterns/drupal-8/page-alter/region-alter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
