Skip to content

Commit

Permalink
New feature: isolate user settings & customization
Browse files Browse the repository at this point in the history
Update commit e52f6e2
  • Loading branch information
khanhlh committed Jun 4, 2014
1 parent a34fc1c commit 9065725
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
3 changes: 3 additions & 0 deletions source/plg_system_t3/includes/joomla25/layout/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ protected function refreshIncludePaths()
// (2) Standard Joomla! layouts overriden
$this->addIncludePaths(JPATH_THEMES . '/' . JFactory::getApplication()->getTemplate() . '/html/layouts');

// (2.1) - user custom layout overridden
$this->addIncludePaths(T3_CUSTOM_PATH . '/html/layouts');

// Component layouts & overrides if exist
$component = $this->options->get('component', null);

Expand Down
6 changes: 5 additions & 1 deletion source/plg_system_t3/includes/joomla25/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -717,10 +717,14 @@ protected function _setPath($type, $path)
$component = preg_replace('/[^A-Z0-9_\.-]/i', '', $component);

//if it is T3 template, update search path for template
$this->_addPath('template', T3_PATH.'/html/' . $component . '/' . $this->getName());
$this->_addPath('template', T3_PATH . '/html/' . $component . '/' . $this->getName());

$fallback = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . $this->getName();
$this->_addPath('template', $fallback);

//search path for user custom folder
$this->_addPath('template', T3_CUSTOM_PATH . '/html/' . $component . '/' . $this->getName());

}
break;
}
Expand Down
5 changes: 4 additions & 1 deletion source/plg_system_t3/includes/joomla30/viewlegacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -729,10 +729,13 @@ protected function _setPath($type, $path)
$component = preg_replace('/[^A-Z0-9_\.-]/i', '', $component);

//if it is T3 template, update search path for template
$this->_addPath('template', T3_PATH.'/html/' . $component . '/' . $this->getName());
$this->_addPath('template', T3_PATH . '/html/' . $component . '/' . $this->getName());

$fallback = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . $this->getName();
$this->_addPath('template', $fallback);

//search path for user custom folder
$this->_addPath('template', T3_CUSTOM_PATH . '/html/' . $component . '/' . $this->getName());
}
break;
}
Expand Down
14 changes: 9 additions & 5 deletions source/plg_system_t3/t3.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,25 @@ function onContentPrepareForm($form, $data)
$form->getName() == 'com_templates.style'
|| $form->getName() == 'com_config.templates'
)) {
JForm::addFormPath(T3_PATH . '/params');
$form->loadFile('template', false);

$_form = clone $form;
$_form->loadFile(T3_PATH . '/params/template.xml', false);
//custom config in custom/etc/assets.xml
$cusXml = T3_CUSTOM_PATH . '/etc/assets.xml';
if (file_exists($cusXml))
$_form->loadFile($cusXml, true, '//config');

// extend parameters
T3Bot::prepareForm($form);

//search for global parameters and store in user state
$app = JFactory::getApplication();
$gparams = array();
foreach($form->getGroup('params') as $param){
if($form->getFieldAttribute($param->fieldname, 'global', 0, 'params')){
foreach($_form->getGroup('params') as $param){
if($_form->getFieldAttribute($param->fieldname, 'global', 0, 'params')){
$gparams[] = $param->fieldname;
}
}
$app->setUserState('gparams', $gparams);
$this->gparams = $gparams;
}

Expand Down

0 comments on commit 9065725

Please sign in to comment.