Hi,
I created a custom layout according to the explanation at http://drupal.org/node/1098068
The problem is that when I drag and drop any field into a region it always ends up in the first region (after ajax save) which in my case is the region "header". When I use the selects instead of the drag & drop, the fields move to the correct region.
I can't use the selects though because my fields need to be added to fieldsets within these regions (and you know you can only select to which region you want to assign a field and not the fieldsets within regions)
Here's the code for my custom template (altough I don't think that has anything to do with it):
3col_3row_equal_width.inc.inc
<?php
function ds_3col_3row_equal_width() {
return array(
'label' => t('Three column three row - Equal width'),
'regions' => array(
'header' => t('Header'),
'first_left' => t('Left (first)'),
'first_middle' => t('Middle (first)'),
'first_right' => t('Right (first)'),
'second_left' => t('Left (second)'),
'second_middle' => t('Middle (second)'),
'second_right' => t('Right (second)'),
'third_left' => t('Left (third)'),
'third_middle' => t('Middle (third)'),
'third_right' => t('Right (third)'),
'footer' => t('Footer')
),
// Add this line if there is a default css file.
'css' => TRUE,
);
}
?>
3col_3row_equal_width.tpl.php
<div class="<?php print $classes;?> clearfix">
<?php if (isset($title_suffix['contextual_links'])): ?>
<?php print render($title_suffix['contextual_links']); ?>
<?php endif; ?>
<div class="ds-row-first ds-row">
<?php if ($header): ?>
<div class="ds-header<?php print $header_classes; ?>">
<?php print $header; ?>
</div>
<?php endif; ?>
<?php if ($first_left): ?>
<div class="ds-first-left<?php print $first_left_classes; ?>">
<?php print $first_left; ?>
</div>
<?php endif; ?>
<?php if ($first_middle): ?>
<div class="ds-first-middle<?php print $first_middle_classes; ?>">
<?php print $first_middle; ?>
</div>
<?php endif; ?>
<?php if ($first_right): ?>
<div class="ds-first-right<?php print $first_right_classes; ?>">
<?php print $first_right; ?>
</div>
<?php endif; ?>
</div>
<div class="ds-row-second ds-row">
<?php if ($second_left): ?>
<div class="ds-second-left<?php print $second_left_classes; ?>">
<?php print $second_left; ?>
</div>
<?php endif; ?>
<?php if ($second_middle): ?>
<div class="ds-second-middle<?php print $second_middle_classes; ?>">
<?php print $second_middle; ?>
</div>
<?php endif; ?>
<?php if ($second_right): ?>
<div class="ds-second-right<?php print $second_right_classes; ?>">
<?php print $second_right; ?>
</div>
<?php endif; ?>
</div>
<div class="ds-row-third ds-row">
<?php if ($third_left): ?>
<div class="ds-third-left<?php print $third_left_classes; ?>">
<?php print $third_left; ?>
</div>
<?php endif; ?>
<?php if ($third_middle): ?>
<div class="ds-third-middle<?php print $third_middle_classes; ?>">
<?php print $third_middle; ?>
</div>
<?php endif; ?>
<?php if ($first_right): ?>
<div class="ds-third-right<?php print $third_right_classes; ?>">
<?php print $third_right; ?>
</div>
<?php endif; ?>
<?php if ($footer): ?>
<div class="ds-footer<?php print $footer_classes; ?>">
<?php print $footer; ?>
</div>
<?php endif; ?>
</div>
</div>
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | ds_forms-underscores_in_regions-1175414-10.patch | 666 bytes | dshields |
| #6 | 1175414.patch | 783 bytes | swentel |
Comments
Comment #1
Percept commentedBtw the reason I can't just use the selects is because my fields need to be assigned to fieldsets within the regions and that's only possible with the drag & drop option.
Comment #2
swentel commentedYeah, it shouldn't be related to the custom layout, this will probably also happen on other layouts too. It's a clash between Field UI, DS and Fieldgroup - I'll have to do some extensive testing here.
Comment #3
Percept commentedThe strange thing is, when I drag and drop a field in my "first_left" region under the fieldset, the field jumps to the first region (header) like described above. But when I save this, the front end actually gets the correct output ie field inside fieldset in the correct region. When I reload the "manage display" page, the field is still showing up in the header region though. Hope that helps anything to narrow down the problem.
Thanks for the quick reply btw.
Comment #4
swentel commentedLooks like the drag and drop doesn't like a region with an underscore, this was fun to find out. Hope I can fix this with the javascript.
Comment #5
swentel commentedHere's a patch. The patch also fixes a notice which is in dev, if you don't want to upgrade right now, just open ds.js and add following line in the regionChange: function
Comment #6
swentel commentedComment #7
Percept commentedGreat, thanks a lot!
Comment #8
swentel commentedOk committed :)
Comment #10
dshields commentedWhile this patch has been fixed in the core Display Suite JavaScript code, it is still an issue in ds_forms submodule. Only the first instance is being replaced. This patch resolves that.
Comment #11
aspilicious commentedTHNX!