/** * 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 * * @return FabrikLayoutFile */ public function getLayout($type) { $name = get_class($this); $name = strtolower(JString::str_ireplace('PlgFabrik_Form', '', $name)); $basePath = COM_FABRIK_BASE . '/plugins/fabrik_form/' . $name . '/layouts'; $layout = new FabrikLayoutFile('fabrik-form-' . $name . '-' . $type, $basePath, array('debug' => false, 'component' => 'com_fabrik', 'client' => 'site')); $layout->addIncludePaths(JPATH_THEMES . '/' . $this->app->getTemplate() . '/html/layouts'); $layout->addIncludePaths(JPATH_THEMES . '/' . $this->app->getTemplate() . '/html/layouts/com_fabrik'); return $layout; }
/** * Format the read only output for the page * * @param string $value Initial value * @param string $label Label * * @return string read only value */ protected function getReadOnlyOutput($value, $label) { $displayData = new stdClass(); $displayData->value = $value; $displayData->tmpl = @$this->tmpl; $displayData->format = $this->app->input->get('format', ''); $basePath = JPATH_ROOT . '/plugins/fabrik_element/yesno/layouts'; $layout = new FabrikLayoutFile('fabrik_element_yesno_details', $basePath); $layout->addIncludePaths(JPATH_THEMES . '/' . $this->app->getTemplate() . '/html/layouts'); return $layout->render($displayData); }
/** * 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; }