Widget system: Difference between revisions

No edit summary
Line 16: Line 16:
Each file is a PHP class that herits the class '''ModeleBoxes'''.
Each file is a PHP class that herits the class '''ModeleBoxes'''.


To create a new box, copy an existing box file and rename it.
To create a new box, copy an existing box file and rename it,for example into '''box_myownbox.php'''.
Then change its content to match the new name and to define informations you want to show by the box.
Then change its content to match the new name and to define informations you want to show by the box.


Line 24: Line 24:
* Once you module descriptor is created, edit it to add lines to declare your box
* Once you module descriptor is created, edit it to add lines to declare your box
<source lang="bash">
<source lang="bash">
$this->boxes[0]['file'] = "box_file.php";
$this->boxes[0]['file'] = "box_myownbox.php";
$this->boxes[0]['note'] = "My notes";
$this->boxes[0]['note'] = "My notes";
$this->boxes[0]['enabledbydefaulton'] = 1;
$this->boxes[0]['enabledbydefaulton'] = 1;
</source>
</source>
* Create a package to distribute your module containing your box (See page [[Module development]]).


= [[File:art.png]] Activate a box =
= [[File:art.png]] Activate a box =
To activate a box, go on page '''Home - Setup - Boxes''' and click on activate on box you want to see. The page will appears on page for which you activate the box.
To activate a box, go on page '''Home - Setup - Boxes''' and click on activate on box you want to see. The page will appears on page for which you activate the box.