Source for file component.php
Documentation is available at component.php
* @package Joomla.Administrator
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Model for component configuration
* @package Joomla.Administrator
* Method to auto-populate the model state.
* Note. Calling getState in this method will result in recursion.
// Set the component (option) we are dealing with.
$component =
$input->get('component');
$state->set('component.option', $component);
// Set an alternative path for the configuration file.
if ($path =
$input->getString('path'))
$state->set('component.path', $path);
* Method to get a form object.
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return mixed A JForm object on success, false on failure
public function getForm($data =
array(), $loadData =
true)
if ($path =
$state->get('component.path'))
// Add the search path for the admin component config.xml file.
// Add the search path for the admin component config.xml file.
array('control' =>
'jform', 'load_data' =>
$loadData),
* Get the component information.
$option =
$state->get('component.option');
// Load common and local language files.
$lang->load($option, JPATH_BASE, null, false, true)
||
$lang->load($option, JPATH_BASE .
"/components/$option", null, false, true);
* Method to save the configuration data.
* @param array $data An array containing all global config data.
* @return boolean True on success, false on failure.
* @throws RuntimeException
public function save($data)
if (isset
($data['params']) && isset
($data['params']['rules']))
if (!$asset->loadByName($data['option']))
$root->loadByName('root.1');
$asset->name =
$data['option'];
$asset->title =
$data['option'];
$asset->setLocation($root->id, 'last-child');
$asset->rules = (string)
$rules;
if (!$asset->check() ||
!$asset->store())
throw
new RuntimeException($table->getError());
// We don't need this anymore
unset
($data['params']['rules']);
// Load the previous Data
if (!$table->load($data['id']))
throw
new RuntimeException($table->getError());
if (!$table->bind($data))
throw
new RuntimeException($table->getError());
throw
new RuntimeException($table->getError());
throw
new RuntimeException($table->getError());
// Clean the component cache.
Documentation generated on Tue, 19 Nov 2013 14:56:15 +0100 by phpDocumentor 1.4.3