コード例 #1
0
 /**
  * Renders the assets for the layout or a node.
  *
  * @since 1.7
  * @access private
  * @return array
  */
 private static function render_assets()
 {
     $partial_refresh_data = self::get_partial_refresh_data();
     $asset_info = FLBuilderModel::get_asset_info();
     $asset_ver = FLBuilderModel::get_asset_version();
     $assets = array('js' => '', 'css' => '');
     // Render the JS.
     if ($partial_refresh_data['is_partial_refresh']) {
         if (!class_exists('FLJSMin')) {
             include FL_BUILDER_DIR . 'classes/class-fl-jsmin.php';
         }
         switch ($partial_refresh_data['node']->type) {
             case 'row':
                 $assets['js'] = FLBuilder::render_row_js($partial_refresh_data['node']);
                 $assets['js'] .= FLBuilder::render_row_modules_js($partial_refresh_data['node']);
                 break;
             case 'column':
                 $assets['js'] = FLBuilder::render_column_modules_js($partial_refresh_data['node']);
                 break;
             case 'module':
                 $assets['js'] = FLBuilder::render_module_js($partial_refresh_data['node']);
                 break;
         }
         $assets['js'] .= 'FLBuilder._renderLayoutComplete();';
         $assets['js'] = FLJSMin::minify($assets['js']);
     } else {
         $assets['js'] = $asset_info['js_url'] . '?ver=' . $asset_ver;
     }
     // Render the CSS.
     $assets['css'] = $asset_info['css_url'] . '?ver=' . $asset_ver;
     // Return the assets.
     return $assets;
 }