/** * Renders the layout data for a new row. * * @since 1.7 * @param string $cols The type of column layout to use. * @param int $position The position of the new row in the layout. * @param string $template_id The ID of a row template to render. * @return array */ public static function render_new_row($cols = '1-col', $position = false, $template_id = null) { // Add a row template? if ($template_id) { // Add the row template. $row = FLBuilderModel::apply_node_template($template_id, null, $position); // Return the response. return self::render($row->node); } else { // Add the row. $row = FLBuilderModel::add_row($cols, $position); // Render the row. ob_start(); FLBuilder::render_row($row); $html = ob_get_clean(); // Return the response. return array('partial' => true, 'nodeType' => $row->type, 'html' => $html, 'js' => 'FLBuilder._renderLayoutComplete();'); } }
/** * Adds a new row to the current layout and renders it. * * @since 1.0 * @param string $cols The type of column layout to use. * @param int $position The position of the new row in the layout. * @return void */ public static function render_new_row($cols = '1-col', $position = false) { $post_data = FLBuilderModel::get_post_data(); $cols = isset($post_data['cols']) ? $post_data['cols'] : $cols; $position = isset($post_data['position']) ? (int) $post_data['position'] : $position; $row = FLBuilderModel::add_row($cols, $position); self::render_row($row); if (defined('DOING_AJAX')) { die; } }