Skip to main content
2 of 2
added 367 characters in body
Lauren G
  • 384
  • 2
  • 10

You can use a preprocess function to add a theme suggestion specifically for this view.

Something like:

function rodekors_theme_suggestions_container_alter(array &$suggestions, array $variables) {
  // since kint() / dpm() aren't working, use a js console.log
  echo "<script>console.log( 'Debug Objects: " . $variables['element']['#name'] . "' );</script>";

  if($variables['element']['#name'] = 'view_name') { // value from console.log
    $suggestions[] = 'suggested_template';
  }
}

Note: The above function is re-worked to function without dpm / kint, as OP had an unrelated debugging error. Usually, the echo "<script..."; code would be replaced with a standard Drupal debug function.

Then you can copy the standard container template file, rename it 'suggested-template', and just remove the outermost wrapping div.

Because that views-element-container is a container around the view, you need to access / alter the code on the container level, instead of the view level. Most likely, even if your unset theme-wrappers code worked, the div would still exist, just without its class.

Lauren G
  • 384
  • 2
  • 10