public static function buildLayoutTree(XenForo_ViewPublic_Base $view, array &$widgets, array $options = array()) { $widgetPage =& $options['widgetPage']; $rows = 0; $cols = 0; $cssClasses = array('cols' => array(), 'rows' => array(), 'xOfY' => array()); $widgetIds = array(); foreach ($widgets as $widget) { if (empty($widget['active'])) { continue; } if (!empty($widget['position'])) { continue; } if (!isset($widget['options']['layout_row'])) { continue; } if (!isset($widget['options']['layout_col'])) { continue; } if (empty($widget['options']['layout_sizeRow'])) { continue; } if (empty($widget['options']['layout_sizeCol'])) { continue; } $rows = max($rows, $widget['options']['layout_row'] + $widget['options']['layout_sizeRow']); $cols = max($cols, $widget['options']['layout_col'] + $widget['options']['layout_sizeCol']); $widgetIds[] = $widget['widget_id']; } for ($col = 1; $col <= $cols; $col++) { $cssClasses['cols'][$col] = array('name' => sprintf('WF_Cols_%d_%d', $widgetPage['node_id'], $col)); if (!empty($widgetPage['options']['column_width']) and !empty($widgetPage['options']['column_gap'])) { $cssClasses['cols'][$col]['width'] = $col * $widgetPage['options']['column_width'] + ($col - 1) * $widgetPage['options']['column_gap']; } } for ($row = 1; $row <= $rows; $row++) { $cssClasses['rows'][$row] = array('name' => sprintf('WF_Rows_%d_%d', $widgetPage['node_id'], $row)); } $options = XenForo_Application::mapMerge(array('params' => $view->getParams(), 'templateObj' => $view->createOwnTemplateObject(), 'positionCode' => md5(implode('_', $widgetIds)), 'rows' => $rows, 'cols' => $cols, 'cssClasses' => $cssClasses, 'layoutCount' => 0), $options); $layout = new _Layout_Vertical($view, $widgets, $options, $widgetIds); $layout->prepare(); $layout->render(); return $layout; }