Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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';
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement