-
Notifications
You must be signed in to change notification settings - Fork 63
Component integration
Florian Voutzinos edited this page Sep 25, 2013
·
3 revisions
To integrate redRAD in your component:
You can start using redRAD directly in the installer script (most of the times install.php):
<?php
/**
* @package Redshopb
* @subpackage Install
*
* @copyright Copyright (C) 2013 redCOMPONENT.com. All rights reserved.
* @license GNU General Public License version 2 or later, see LICENSE.
*/
defined('_JEXEC') or die;
// Find redRAD installer to use it as base system
if (!class_exists('Pkg_RedradInstallerScript'))
{
$searchPaths = array(
// Install
dirname(__FILE__) . '/redRAD',
// Discover install
JPATH_ADMINISTRATOR . '/manifests/packages/redrad',
// Uninstall
JPATH_LIBRARIES . '/redrad'
);
if ($redradInstaller = JPath::find($searchPaths, 'install.php'))
{
require_once $redradInstaller;
}
}
/**
* Custom installation of Redshop b2b.
*
* @package Redshopb
* @subpackage Install
* @since 1.0
*/
class Com_RedshopbInstallerScript extends Pkg_RedradInstallerScript
{
}That will extend the redRAD installer (Pkg_RedradInstallerScript) so your installer is 100% free of redRAD stuff. When your component gets installed the parent class will automatically install redRAD.
To be detected as a redRAD component the manifest also requires that you add:
<redrad version="1.0" />Manifest example:
<name>COM_REDSOURCE</name>
<creationDate>June 2013</creationDate>
<author>redCOMPONENT</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.redcomponent.com</authorUrl>
<copyright>Copyright (C) 2008 - 2013 redCOMPONENT.com. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later, see LICENSE.</license>
<version>1.0.0</version>
<description>COM_REDSOURCE_DESC</description>
<scriptfile>install.php</scriptfile>
<redrad version="1.0" />That information is also stored in the standard component parameters so you can do:
<?php
$comParams = JComponentHelper::getParams('com_redshopb');
$redradParams = $comParams->get('redrad');redCORE documentation menu: