Example #1
0
 /**
  * Get editing template.
  *
  * @return  object  Object containing template details or NULL if failure.
  */
 public static function &getEditingTemplate()
 {
     if (!isset(self::$templateData)) {
         $app = JFactory::getApplication();
         $data = null;
         if ($app->input->getCmd('option') == 'com_templates' and $app->input->getCmd('view') == 'style' and $app->input->getCmd('layout') == 'edit' and $app->input->getInt('id')) {
             // Get template model
             $model = class_exists('JModelLegacy') ? JModelLegacy::getInstance('Style', 'TemplatesModel') : JModel::getInstance('Style', 'TemplatesModel');
             // Get style data
             $data = $model->getItem($app->input->getInt('id'));
             // Instantiate helper class of JSN Template Framework
             $helper = JSNTplTemplateHelper::getInstance();
             // Prepare template parameters
             $data->params = $helper->loadParams($data->params, $data->template);
         }
         // Store template data
         self::$templateData = $data;
     }
     return self::$templateData;
 }