Component description file - .description.php
The file .description.php contains the component description. The
description is used when manipulating the component from within Bitrix Site
Manager (e.g. in the visual editor), and in the site editing mode. The component
itself does not use this file; it is not included when the component is
activated (for example, when loading a page containing the component).
The file .description.php must reside in the component subfolder. The
corresponding language message file is loaded automatically (it must reside in
/lang/<language>/.description.php relative to the component
folder).
A typical .description.php file 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" => "Product catalog"
)
),
"AREA_BUTTONS" => array(
array(
'URL' => "javascript:alert('This is a button!!!');",
'SRC' => '/images/button.jpg',
'TITLE' => "This is a button!"
),
),
"CACHE_PATH" => "Y",
"COMPLEX" => "Y"
);
?>
As you can see, the file declares the array $arComponentDescription,
which describes the component. This array can have the following keys:
- "NAME" - the name of the component;
- "DESCRIPTION" - the description of the component;
- "ICON" - the path to a component icon relative to the component
folder. This icon is used, for example, in the visual editor;
- "PATH" - disposition of the component in the virtual tree of
components in the visual editor. The value of this key is an array with the
following keys:
- "ID" - the ID of a tree branch;
- "NAME" - the name of a tree branch;
- "CHILD" - child or subordinate branch. This value can define a
subordinate branch of a tree of the same structure as a parent
branch.
The maximum number of tree levels is 3. Usually, a two-level
tree is used in which the components occupy the second level. The following
names of the first level are reserved and cannot be used:: "content",
"service", "communication", "e-store",
"utility".
If the "PATH" key does not exist, the
component will not be visible in the visual editor;
- "AREA_BUTTONS" - custom buttons that are visible in the site
editing mode;
- "CACHE_PATH" - if "Y", the cache flush button is displayed
in the site editing mode. The cache is supposed to reside in /<site
ID>/<relative path to component>). A value of non-empty string
other than "Y" indicates that this value is the non-standard path to
the cache, and the cache flush button is also displayed;
- "COMPLEX" - "Y" for compound components. This key is
meaningless for simple components.