english/administrator/components/com_modules/models/module.php
/**
	 * @param	object	A form object.
	 * @param	mixed	The data expected for the form.
	 *
	 * @return	void
	 * @throws	Exception if there is an error loading the form.
	 * @since	1.6
	 */
@param       object  A form object.
@param       mixed   The data expected for the form.

@return      void
@throws      Exception if there is an error loading the form.
@param object A form object . @param mixed The data expected for the form . @return void @throws Exception if there is an error loading the form .
protected function preprocessForm(JForm $form, $data, $group = '')
	{
		jimport('joomla.filesystem.file');
		jimport('joomla.filesystem.folder');
		$lang		= JFactory::getLanguage();
		$clientId	= $this->getState('item.client_id');
		$module		= $this->getState('item.module');
		$client		= JApplicationHelper::getClientInfo($clientId);
		$formFile	= JPath::clean($client->path.'/modules/'.$module.'/'.$module.'.xml');
			$lang->load($module, $client->path, null, false, false)
		||	$lang->load($module, $client->path.'/modules/'.$module, null, false, false)
		||	$lang->load($module, $client->path, $lang->getDefault(), false, false)
		||	$lang->load($module, $client->path.'/modules/'.$module, $lang->getDefault(), false, false);
		if (file_exists($formFile)) {
			if (!$form->loadFile($formFile, false, '//config')) {
				throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
			}
			if (!$xml = simplexml_load_file($formFile)) {
				throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
			}
			$help = $xml->xpath('/extension/help');
			if (!empty($help)) {
				$helpKey = trim((string) $help[0]['key']);
				$helpURL = trim((string) $help[0]['url']);
				$this->helpKey = $helpKey ? $helpKey : $this->helpKey;
				$this->helpURL = $helpURL ? $helpURL : $this->helpURL;
			}
		}
		parent::preprocessForm($form, $data, $group);
	}
protected function preprocessForm ( JForm $ form , $ data , $ group = '' ) { jimport ( 'joomla.filesystem.file' ) ; jimport ( 'joomla.filesystem.folder' ) ; $ lang = JFactory :: getLanguage ( ) ; $ clientId = $ this -> getState ( 'item.client_id' ) ; $ module = $ this -> getState ( 'item.module' ) ; $ client = JApplicationHelper :: getClientInfo ( $ clientId ) ; $ formFile = JPath :: clean ( $ client -> path . '/modules/' . $ module . '/' . $ module . '.xml' ) ; $ lang -> load ( $ module , $ client -> path , null , false , false ) || $ lang -> load ( $ module , $ client -> path . '/modules/' . $ module , null , false , false ) || $ lang -> load ( $ module , $ client -> path , $ lang -> getDefault ( ) , false , false ) || $ lang -> load ( $ module , $ client -> path . '/modules/' . $ module , $ lang -> getDefault ( ) , false , false ) ; if ( file_exists ( $ formFile ) ) { if ( ! $ form -> loadFile ( $ formFile , false , '//config' ) ) { throw new Exception ( JText :: _ ( 'JERROR_LOADFILE_FAILED' ) ) ; } if ( ! $ xml = simplexml_load_file ( $ formFile ) ) { throw new Exception ( JText :: _ ( 'JERROR_LOADFILE_FAILED' ) ) ; } $ help = $ xml -> xpath ( '/extension/help' ) ; if ( ! empty ( $ help ) ) { $ helpKey = trim ( ( string ) $ help [ 0 ] [ 'key' ] ) ; $ helpURL = trim ( ( string ) $ help [ 0 ] [ 'url' ] ) ; $ this -> helpKey = $ helpKey ? $ helpKey : $ this -> helpKey ; $ this -> helpURL = $ helpURL ? $ helpURL : $ this -> helpURL ; } } parent :: preprocessForm ( $ form , $ data , $ group ) ; }
@param       object  A form object.
@param object A form object .
// Initialise variables. // Load the core and/or local language file(s). // Get the module form. // Attempt to load the xml file. // Get the help data from the XML file if present. // Trigger the default form events.