Creating an e107 plugin

Upgrading v1.x Plugins

Your Plugin's Admin Area

We recommend plugin developers to upgrade their admin areas using the 'Plugin Builder' in the 'Plugin Manager" area. It allows you to select your e107 _sql file from your plugin folder, or directly from the database table list and will generate most of the new code for the admin-area of your plugin. It will also generate the new plugin.xml meta-file, which is used during installation of your plugin and also when sharing plugins via this site. The advantages of using the new admin system are numerous - including, but not limited to:

  • No need to code in the HTML or the process of reading or writing to your database.
  • Consistent interface with the rest of admin
  • Users can select which fields from your db table they wish to view - based on your predefined list.
  • Media-Manager is integrated into the system.
  • Easily add drag and drop sorting/re-ordering to your plugin.
  • Easily add batch delete, copy, featurebox creation, sitelink creation, userclass modification, etc. etc.
  • Easily add inline editing to your data.
  • Easily add tabs to keep your plugin's admin-area well organized.

Your Plugin's Front End

Minimum Changes:

  • Include a plugin.xml file

Recommended Changes:

  • Include a plugin.xml file
  • Use e107's form_handler class for all form elements.
  • Use Bootstrap 3 html/css standards in your templates and/or HTML markup
  • Upgrade e_xxxx.php files to v2 standards
  • Upgrade language-file names to new standards

Migrating Plugin Preferences to their own table row.

In e107 v.2x we recommend plugins to save their preferences to their own table row, however old plugins may still be storing them in the core preference table.

To easily migrate from one to the other, we created a simple method called migrateData().

		$oldPluginPrefs = array(
    'myplugin_caption' => 'caption', // old-pref-name => new-pref-name 
    'myplugin_display' => 'display',
    'myplugin_maxage' => 'maxage',
);

if($newPrefs = e107::getConfig()->migrateData($oldPluginPrefs,true)) // returns new array with values and deletes core pref. 
{
    $result = e107::getPlugConfig('myplugin')->setPref($newPrefs)->save(false,true,false); // save new prefs to 'myplugin'. 
}


Thursday 13 June 2013 - 00:00:00 admin,

Social Links