/** * Get the element's JLayout file * Its actually an instance of FabrikLayoutFile which inverses the ordering added include paths. * In FabrikLayoutFile the addedPath takes precedence over the default paths, which makes more sense! * * @param string $name Layout file name (eg. fabrik-element-label) * @param array $paths Optional paths to add as includes * @param array $options Layout options * * @return FabrikLayoutFile */ public static function getLayout($name, $paths = array(), $options = array()) { $defaultOptions = array('debug' => false, 'component' => 'com_fabrik', 'client' => 'site'); $options = array_merge($defaultOptions, $options); $basePath = COM_FABRIK_BASE . '/com_fabrik/layouts'; $layout = new FabrikLayoutFile($name, $basePath, $options); $layout->addIncludePaths(JPATH_SITE . '/layouts'); $layout->addIncludePaths(JPATH_THEMES . '/' . JFactory::getApplication()->getTemplate() . '/html/layouts'); $layout->addIncludePaths(JPATH_THEMES . '/' . JFactory::getApplication()->getTemplate() . '/html/layouts/com_fabrik'); foreach ($paths as $path) { $layout->addIncludePath($path); } return $layout; }
/** * Get the element's JLayout file * Its actually an instance of FabrikLayoutFile which inverses the ordering added include paths. * In FabrikLayoutFile the addedPath takes precedence over the default paths, which makes more sense! * * @param string $type form/details/list * @param array $paths Optional paths to add as includes * * @return FabrikLayoutFile */ public function getLayout($type, $paths = array(), $options = array()) { $defaultOptions = array('debug' => false, 'component' => 'com_fabrik', 'client' => 'site'); $options = array_merge($defaultOptions, $options); $basePath = $this->layoutBasePath(); $layout = new FabrikLayoutFile('fabrik-element-' . $this->getPluginName() . '-' . $type, $basePath, $options); foreach ($paths as $path) { $layout->addIncludePath($path); } $layout->addIncludePaths(JPATH_SITE . '/layouts'); $layout->addIncludePaths(JPATH_THEMES . '/' . $this->app->getTemplate() . '/html/layouts'); $layout->addIncludePaths(JPATH_THEMES . '/' . $this->app->getTemplate() . '/html/layouts/com_fabrik'); // Custom per element layout... $layout->addIncludePaths(JPATH_THEMES . '/' . $this->app->getTemplate() . '/html/layouts/com_fabrik/element/' . $this->getFullName(true, false)); return $layout; }