Skip to content
Snippets Groups Projects

Issue #2878684 by samuel.mortenson: Use String.match to correlate regions when...

Open Joseph Olstad requested to merge issue/panels-2878684:2878684-use-string.match-to into 8.x-4.x
1 file
+ 8
3
Compare changes
  • Side-by-side
  • Inline
@@ -173,10 +173,15 @@
// @todo Our backend should inform us of region suggestions.
regions.each(function (region) {
// If a layout with the same name exists, copy our block collection.
var new_region = layout.get('regionCollection').get(region.get('name'));
var potential_regions = layout.get('regionCollection').filter(function (item) {
if (item.get('name') != null) {
return item.get('name').match(region.get('name')) || region.get('name').match(item.get('name'));
}
});
var new_region = layout.get('regionCollection').get(region.get('name')) || potential_regions[0];
// If a layout with a similar name exists, copy our block collection.
if (new_region) {
new_region.set('blockCollection', region.get('blockCollection'));
new_region.get('blockCollection').add(region.get('blockCollection').toJSON());
}
// Otherwise add these blocks to our generic pool.
else {
Loading