1 <?php
 2 /**
 3  * @package     FrameworkOnFramework
 4  * @subpackage  layout
 5  * @copyright   Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
 6  * @license     GNU General Public License version 2 or later; see LICENSE.txt
 7  */
 8 // Protect from unauthorized access
 9 defined('FOF_INCLUDED') or die;
10 
11 /**
12  * Helper to render a FOFLayout object, storing a base path
13  *
14  * @package  FrameworkOnFramework
15  * @since    x.y
16  */
17 class FOFLayoutHelper extends JLayoutHelper
18 {
19     /**
20      * Method to render the layout.
21      *
22      * @param   string  $layoutFile   Dot separated path to the layout file, relative to base path
23      * @param   object  $displayData  Object which properties are used inside the layout file to build displayed output
24      * @param   string  $basePath     Base path to use when loading layout files
25      *
26      * @return  string
27      */
28     public static function render($layoutFile, $displayData = null, $basePath = '')
29     {
30         $basePath = empty($basePath) ? self::$defaultBasePath : $basePath;
31 
32         // Make sure we send null to FOFLayoutFile if no path set
33         $basePath = empty($basePath) ? null : $basePath;
34         $layout = new FOFLayoutFile($layoutFile, $basePath);
35         $renderedLayout = $layout->render($displayData);
36 
37         return $renderedLayout;
38     }
39 }
40