Views: 12184
Last Modified: 18.09.2014
The file .description.php contains a description of the component. This description is used for work with the component (for example, in a visual editor) and also for work in the website editing mode. During the work of the component itself (when invoking the page where the component is located), the description is not used, and the file .description.php is not connected.
The file .description.php must be located in the component folder. The language file connects automatically (it must be located in the folder /lang/<language>/.description.php of the component folder).
Typically, the file .description.php has the following structure:
<?
$arComponentDescription = array(
"NAME" => GetMessage("COMP_NAME"),
"DESCRIPTION" => GetMessage("COMP_DESCR"),
"ICON" => "/images/icon.gif",
"PATH" => array(
"ID" => "content",
"CHILD" => array(
"ID" => "catalog",
"NAME" => "Catalog"
)
),
"AREA_BUTTONS" => array(
array(
'URL' => "javascript:alert('Button');",
'SRC' => '/images/button.jpg',
'TITLE' => "Button"
),
),
"CACHE_PATH" => "Y",
"COMPLEX" => "Y"
);
?>
As we can see, the file determines the array $arComponentDescription which describes the component. This array may have the following keys:
- NAME - name of the component;
- DESCRIPTION - description of the component;
- ICON - path to the pictogram of the component from the component folder. The icon of the component is used in different parts of the system (e.g., in the visual editor);
- PATH - component location in the virtual tree of the component in the visual editor. The value of this element must be an array with the following keys:
- ID - code of the tree branch. Node ID must be unique within the entire component tree (including standard nodes). If the nodes have two equal ID, both of them will not open. E.g., for the proprietary component the ID node = “news” is selected, and such ID already exists for standard components.
- NAME - name of the tree branch. It must be indicated. The NAME is taken from any component from the node. If no NAME is found or there is no language constant necessary, ID is used as a NAME.
- CHILD - a child or subordinate branch. In the element with the CHILD key a subordinate branch of the tree with the same structure as the parent branch can be set up.
The tree is limited to three tiers. As a rule, a two-tier tree is built, and the components are located on the second tier. The following service names of the first tier are reserved and cannot be used: content, service, communication, e-store and utility.
If the PATH key is not established, the component will not be available in the visual editor.
- AREA_BUTTONS - user buttons shown for the component in the website editor mode;
- CACHE_PATH - if the value is equal to Y, the cache flush button of the component is shown in the website editor mode (the cache is supposed to be located at the standard path: /<website code>/<relative path to the component>). If equal to a non-empty line different from Y, the cache flush button of the component is shown in the website editor mode (the cache is located at the path equal to the value with the key CACHE_PATH - for non-standard paths);
- COMPLEX - the element must have the value Y for a composite component and has no significance for simple components.