Hi, I'm really enjoying trying out omega 4.x so far; thanks for creating this! I did happen to notice some weirdness when trying to use the newly included panels layouts with display suite, and thought I would file a bug. I'm using display suite and the two column panels layout. There are two issues I'm seeing. The first is in the way the page renders. It shows the text "Array" in empty areas:

dstest.png

The second issue is that under "manage display" for the content type, it won't let me move fields to anywhere except the Top Left area:

ds_fields.png

Here is what I have selected for the layout:

ds.png

Any ideas?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bkildow’s picture

Component: User interface » Code
Status: Active » Needs review
FileSize
1.74 KB

I think I figured it out! The issue of not being able to move around the fields looks like it due to the way the plugin array is defined. Switching to underscores in the theme definition seems to fix this issue (i.e. top_left instead of top-left). In regard to the other issue of showing arrays, it looks like display suite adds some extra elements to the $content array. I fixed the issue by explicitly printing the regions instead of looping over $content variable.

peteainsworth’s picture

I've tested your patch and both the changes to grid-2.inc and grid-2.tpl.php work well with display suite and panels.

msmithcti’s picture

Status: Needs review » Needs work

That makes sense that display sweet could choke on the hyphens instead of underscores. Not tested this yet but just a quick review:

+++ b/omega/panels/layouts/grid-2/grid-2.tpl.php
@@ -10,11 +10,22 @@
-  <?php foreach($content as $item): ?>
-    <?php if (!empty($item)): ?>
-      <div class="grid-item">
-        <?php print $item ?>
-      </div>
-    <?php endif; ?>
-  <?php endforeach; ?>

Why is this loop being removed in favour of hardcoding each item?

bkildow’s picture

Display suite looks like it adds extra render array elements to the $content variable depending on what fields are added. By hardcoding the regions, it avoids printing any extra stuff that's not needed. If you want to keep the loop, checking for and excluding arrays might work as well:

<?php foreach($content as $item): ?>
   <?php if (!empty($item) || !is_array($item)): ?>
     <div class="grid-item">
       <?php print $item ?>
     </div>
   <?php endif; ?>
<?php endforeach; ?>
fubhy’s picture

That makes sense that display sweet could choke on the hyphens instead of underscores. Not tested this yet but just a quick review:

"Display Sweet" - I lol'ed :P

Anyways.. I am also in favor of the loop, especially because it has this check:

+++ b/omega/panels/layouts/grid-2/grid-2.tpl.php
@@ -10,11 +10,22 @@
-    <?php if (!empty($item)): ?>
-      <div class="grid-item">
-        <?php print $item ?>
-      </div>
-    <?php endif; ?>
fubhy’s picture

Display suite looks like it adds extra render array elements to the $content variable depending on what fields are added. By hardcoding the regions, it avoids printing any extra stuff that's not needed. If you want to keep the loop, checking for and excluding arrays might work as well:

In that case, we should explicitly loop over array_intersect_key() with the regions defined in the layout.

fubhy’s picture

Status: Needs work » Fixed
FileSize
1.28 KB

I committed it like this!

Thanks @bkildow!

peteainsworth’s picture

Status: Fixed » Needs review
FileSize
573 bytes

In my testing this fix generated an 'Undefined variable: layout' error on a display suite page.

is_array() works on panels and display suite pages provided the || in #2093175-4: Display Suite and Panels Layout Weirdness is swapped for &&

steinmb’s picture

Issue summary: View changes

@peteainsworth not sure I you suggest #7 reverted and #8 committed as a better fix?