You can create a package from Home > New > Other Projects > Other Files > Package. It will include sample content you can customize to start with.
At the beginning of a package, you must include the following files:
<?php require_once("rpcl/rpcl.inc.php"); use_unit("designide.inc.php");
The title is displayed on the list at Home > Packages to identify your package. You can define it with the following function:
A package can define a folder where the icons related to that package will be stored. That folder is used to:
To define that directory, call
setIconPath() with the relative path of the icons folder as argument.
For example, if the icons are on a icons folder in the same directory where the package is, add the following line to the package:
You can optionaly define an icon and text to be displayed in HTML5 Builder while your package is being loaded.
addSplashBitmap("My Company Components for X Feature", "splash.png");
The icon must be located in the icons’ folder.
To register your components so they are available on the Tool Palette when the package is installed and enabled, use the following function:
registerComponents("ToolPaletteCategory", array("ComponentName1", "ComponentName2", "ComponentName3"), "custom/custom.inc.php");
The function expects the following parameters:
- The name of the category of the Tool Palette where the components should be listed. It can be an existing category, but can also be a new one just for your components.
- An array of names of components defined in the target description file (see the next point).
- The path to the description file, the one where the components are defined. The path must be relative to the RPCL directory.
You can call this function as many times as you need, so you can register components in different categories even if they are defined in the same file, or components from different files in the same category.
To associate an icon to your component:
- Create a 16×16 PNG image file named after your component. For example: ComponentName.png.
- You can optionally provide higher resolutions of the icon (24×24, 32×32, 48×48 and 64×64) and name them ComponentName_SideSize.png (e.g. MyComponent_64.png).
- Place the image or images inside your package‘s icons folder.
The associated icon will be displayed, for example, in the Tool Palette.
For those properties with a value other than plain text, you should register a property editor. Property editors provide an user-friendly experience to edit special properties from the Object Inspector.
- See Property Editors.
The deployment wizards should be able to locate the most part of the files that make up your project: packages, description files, component icons, and more.
You can specify additional files needed by your components using the following function:
registerAsset(array("ComponentName1", "ComponentName2", …),array("AssetsPath1", "AssetsPath2", …));
- An array of names of component that require the assets.
- An array of paths to files or folders required by the specified components.
For example, if you had a component called ZComponent depending on the whole Zend folder of the RPCL, you could register that folder as an asset for the component with the following code: