* Expand the layout items into an object for the rendering function
(row, align, items)
| 3300 | * Expand the layout items into an object for the rendering function |
| 3301 | */ |
| 3302 | function _layoutItems(row, align, items) { |
| 3303 | if (Array.isArray(items)) { |
| 3304 | for (var i = 0; i < items.length; i++) { |
| 3305 | _layoutItems(row, align, items[i]) |
| 3306 | } |
| 3307 | |
| 3308 | return |
| 3309 | } |
| 3310 | |
| 3311 | var rowCell = row[align] |
| 3312 | |
| 3313 | // If it is an object, then there can be multiple features contained in it |
| 3314 | if ($.isPlainObject(items)) { |
| 3315 | // A feature plugin cannot be named "features" due to this check |
| 3316 | if (items.features) { |
| 3317 | if (items.rowId) { |
| 3318 | row.id = items.rowId |
| 3319 | } |
| 3320 | if (items.rowClass) { |
| 3321 | row.className = items.rowClass |
| 3322 | } |
| 3323 | |
| 3324 | rowCell.id = items.id |
| 3325 | rowCell.className = items.className |
| 3326 | |
| 3327 | _layoutItems(row, align, items.features) |
| 3328 | } else { |
| 3329 | Object.keys(items).map(function (key) { |
| 3330 | rowCell.contents.push({ |
| 3331 | feature: key, |
| 3332 | opts: items[key] |
| 3333 | }) |
| 3334 | }) |
| 3335 | } |
| 3336 | } else { |
| 3337 | rowCell.contents.push(items) |
| 3338 | } |
| 3339 | } |
| 3340 | |
| 3341 | /** |
| 3342 | * Find, or create a layout row |