
plgSystemLanguageroot
By: a guest on
Aug 15th, 2012 | syntax:
PHP | size: 0.90 KB | hits: 39 | expires: Never
<?php
defined('_JEXEC') or die;
class plgSystemLanguageroot extends JPlugin
{
public function __construct( $subject, $config )
{
parent::__construct( $subject, $config );
}
public function onContentPrepareForm($form, $data)
{
if (!($form instanceof JForm))
{
$this->_subject->setError('JERROR_NOT_A_FORM');
return false;
}
if( $form->getName() != 'com_menus.item' )
{
return true;
}
$path = JPATH_PLUGINS.DS.'system'.DS.'languageroot'.DS.'form';
JForm::addFormPath( $path );
$form->loadFile( 'form', false );
return true;
}
public function onContentPrepareData( $context, $data )
{
JForm::addFormPath( $this->getFormPath() );
$data->languageroot = array( 'test' => 'test' );
return true;
}
private function getFormPath()
{
return JPATH_PLUGINS.DS.'system'.DS.'languageroot'.DS.'form';
}
}
?>