Overview
The NextGenEditor project has been conceived to render very easy the creation of new widgets. This is a very simple way to build small components like business content, charts, small tables with custom params editable for end users.
These components can bennefit from many preset features : front-end access for settings, display settings, conditional display, edition permissions, inline-editing..
As the project is rather recent, there is still no development kit, and not yet some documentation.
Principle
Here are some simple explanations. Please contact us if you want more explanations to create your widgets.
Simple to use
The implementation is basically very simple. Do be afraid if you see our existing widgets. They are incredibly complex. For our widgets, we have added many advanced mecanisms to have fast modular screens, a technical API, inline-editing in many content types, and all the rendered contents modular and overridable.
In database
Each widget has a record in the #__nge_parts_library. The "part" field gives the name of the physical directory : "myproject.mywidget"
For example here, adding a widget in the "Content Panels" category (category id 5)
INSERT INTO `#__nge_parts_library` (`part`, `title`, `description`, `ordering`, `catid`) VALUES('myproject.mywidget', 'My widget title', 'My widget description', 1, 5);
Configuration screen
defined('_JEXEC') or die;
//Loading configuration form : config.xml, with the parameters saved for this part
$jform = NgeConfigHelper::loadForm('config', $part);
//Rendering the form, rendering all fields in the "configuration" fieldset
echo $jform->getControlGroups('configuration');
Create a file components/com_nge/parts/myproject/mywidget/config.xml
<?xml version="1.0" encoding="UTF-8"?> <form> <fieldset name="configuration"> <field type="text" name="label" default = "Hello World" label="Label" description="Description" /> <field type="textarea" name="body" default = "" label="Label 2" description="Description" /> </fieldset> </form>
Rendering file
defined('_JEXEC') or die; //Loading parameters $params = new JRegistry; $params->loadString($part->params); //$part contains saved parameters /******************* Sample HTML here ****************************/ ?> <h1><?php echo $params->get('label'); ?></h1> <div class="well"><?php echo $params->get('body'); ?></div>