code: function buildStack(app, name, view) {
      var layoutExists = false;
      var registered = 0;
      var layouts = {};
  
      // get all collections with `viewType` layout
      var collections = app.viewTypes.layout;
      var len = collections.length;
      var idx = -1;
  
      while (++idx < len) {
        var collection = app[collections[idx]];
  
        // detect if at least one of the collections has
        // our starting layout
        if (!layoutExists && collection.getView(name)) {
          layoutExists = true;
        }
  
        // add the collection views to the layouts object
        for (var key in collection.views) {
          layouts[key] = collection.views[key];
          registered++;
        }
      }
  
      if (registered === 0) {
        throw app.formatError('layouts', 'registered', name, view);
      }
  
      if (layoutExists === false) {
        throw app.formatError('layouts', 'notfound', name, view);
      }
      return layouts;
    }
docs: Get the layout stack by creating an object from all
  collections with the "layout" `viewType`
  
  @param {Object} `app`
  @param {String} `name` The starting layout name
  @param {Object} `view`
  @return {Object} Returns the layout stack.