/** * Renders the layout data to be passed back to the builder. * * @since 1.7 * @param string $node_id The ID of a node to try and render instead of the entire layout. * @param string $old_node_id The ID of a node that has been replaced in the layout. * @return array */ public static function render($node_id = null, $old_node_id = null) { // Update the node ID in the post data? if ($node_id) { FLBuilderModel::update_post_data('node_id', $node_id); } // Render CSS and JS assets. FLBuilder::render_assets(); // Register scripts needed for shortcodes and widgets. self::register_scripts(); // Dequeue scripts and styles to only capture those that are needed. self::dequeue_scripts_and_styles(); // Get the partial refresh data. $partial_refresh_data = self::get_partial_refresh_data(); // Render the markup. $html = self::render_html(); // Render scripts and styles. $scripts_styles = self::render_scripts_and_styles(); // Render the assets. $assets = self::render_assets(); // Return the response. return array('partial' => $partial_refresh_data['is_partial_refresh'], 'nodeId' => $partial_refresh_data['node_id'], 'nodeType' => $partial_refresh_data['node_type'], 'oldNodeId' => $old_node_id, 'html' => $html, 'scriptsStyles' => $scripts_styles, 'css' => $assets['css'], 'js' => $assets['js']); }