I've created a new sub-theme called "evo" using the "omega_startkit" as the boilerplate code.

After adding additional regions I've noticed the {{region_classes}} array in the page.html.twig template file isn't correctly imploding the array. It's omitting a space between the different region class arrays.

Incorrect Array Implode
"branding-layout with--branding without--menusnavigation-layout with--navigationhero-layout with--herofocus-layout"

Correct Array Implode
"branding-layout with--branding without--menus navigation-layout with--navigation hero-layout with--hero focus-layout"

A solution, for anyone interested in quickly solving the problem is to alter the "omega.theme" file in the base Omega on lines 311. By omitting the (from what I can see unnecessary) ['#plain_text'] array field added to each "group_id" array.

$pass_classes[$group_id]['#plain_text'] = implode(" ", $region_classes[$group_id]);

turns into

$pass_classes[$group_id] = implode(" ", $region_classes[$group_id]);

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kamescg created an issue. See original summary.

kamescg’s picture

Issue summary: View changes
Axel Pressbutton’s picture

Hi @kamescg

It appears that this is also an issue for a clean install of Drupal 8 along with an unmodified Omega theme/subthem (in terms of additional Regions).

The following is from the default homepage of a fresh build:

<div id="page" class="clearfix header-layout with--header without--menuspreface-layout with--preface-first without--preface-second without--preface-third without--preface-fourthcore-layout with--highlightedmain-layout with--content with--sidebar-first with--sidebar-secondpostscript-layout without--postscript-first without--postscript-second without--postscript-third without--postscript-fourthfooter-layout with--footer-core-layout">

In this scenario, simply removing ['#plain_text'] results in:

<div id="page" class="clearfix ">

As the output of $pass_classes is a multi-dimensional array with each of the arrays within it being a render array, I found that an alternate way to fix this was to keep the arrays as they were but then join them together in page.tpl.twig with the use of the safe_join option (Filters - Modifying Variables In Twig Templates)...

<div id="page" class="clearfix {{ region_classes|safe_join(" ") }}">

The resulting output is then;

<div id="page" class="clearfix header-layout with--header without--menus preface-layout with--preface-first without--preface-second without--preface-third without--preface-fourth core-layout with--highlighted main-layout with--content with--sidebar-first with--sidebar-second postscript-layout without--postscript-first without--postscript-second without--postscript-third without--postscript-fourth footer-layout with--footer -core-layout">

Axel Pressbutton’s picture

Here's a small patch...

kamescg’s picture

@Axel - A much better solution :)

I went to confirm removing ['#plain_text'] created a an empty return array, and lo'an'behold you were correct. Oddly enough, this wasn't the case when I first applied the change, which I'll go ahead and blame on the cache. Still getting used to Drupal 8, but loving Twig already!

Axel Pressbutton’s picture

Status: Active » Needs review
Axel Pressbutton’s picture

Thanks @kamescg.

Yes, really liking Twig as well!