This blog post is outdated. For latest information about how to create extension, please refer to Extensions Wiki Page.
It had to happen sooner or later - CiviCRM is growing with with variety of functionality, where people can plug in their own, custom pieces and make CiviCRM more tailored to their needs. Most prominent examples at the moment include payment processors, custom searches and custom reports. Don't confuse it with "larger scale" customisation, like writing Drupal modules which - using API and hooks - modify CiviCRM behaviour. We're talking about well defined, self-contained pieces of code which throw in some useful functionality into your existing installation. As of now, it's a bit of a hassle to install them - you need to put files in proper places, register them using administrator section and so on: nothing extremely complicated, but also definitely not the easiest part of CiviCRM setup and configuration. More to that, some very useful extensions (like some payment processors) are shipped with vanilla CiviCRM, but not supported by core team, some of them are not shipped, but available only from forums or issue tracker. In general - you can find a lot of useful things, it's just requires some effort.
So now, what if you could just install CiviCRM, than go to an "Extensions" admin page, review available pieces, pick what you need from the list and just click "Install" button? We felt tempted to make it happen and some time ago we started talking about such feature. Now it's time to start introducing it - CiviCRM 3.3 will provide the first pieces of more long term effort in making CiviCRM extensibility easier. Work is currently in progress, most of pieces are there already (expect first demo in a few days), but before pushing out the first version, we would like to get your feedback and/or constructive criticism on the path we're taking. During next few weeks, before we hit alpha with 3.3, I will be publishing blog posts describing different aspects of how our extensions will work. If you're interested in this topic, follow the Extensions category on the blog and be active in comments (and in other ways as well, but that's to be announced later on). :-)
What will you see in the first phase of building our extensions framework? In CiviCRM 3.3 you will see:
I suspect that whole 3.3 life cycle period will be mainly about gathering experience with with packaged extensions - in that sense it will be more of an experimental functionality. Old ways of installing payment processors, custom searches and custom reports will be still available. After this "trial period", as the number of packaged extension grows, we'll start eliminating pieces of old functionality, but backwards compatibility will be held over at least 1-2 versions ahead.
Here we go, let's go with introducing first, most fundamental concept of our extension framework. We need to know what given extension does, who wrote it, who supports it and quite a few other things. That's what info file is for. It's in XML format and it's relatively simple. Here's an example:
<?xml version="1.0" encoding="UTF-8" ?> <extension key="org.civicrm.activity" type="search"> <callback>ActivitySearch</callback> <name>Activity Search</name> <description> This custom search allows to search through activities and returns activities as results (not contacts as regular search). </description> <url>http://civicrm.org</url> <license>AGPL</license> <maintainer>CiviCRM Core Team <email@example.com></maintainer> <releaseDate>2010-09-01</releaseDate> <version>1.0</version> <compatibility> <ver>3.3</ver> <ver>3.4</ver> </compatibility> <develStage>beta</develStage> <comments>For support, please contact project team on the forums. (http://forum.civicrm.org)</comments> </extension>
Quick description of XML elements:
Loving all the things localised, we've added that too. There is possibility to provide extension description in other languages - optional localisedInfo section of the info file does that:
<extension ...> ...regular stuff <localisedInfo> <pl_PL> <description>Opis po polsku.</description> <maintainer>Zespół CiviCRM <firstname.lastname@example.org></maintainer> <comments>Wsparcie dla tego rozszerzenia dostępne na forum CiviCRM (http://forum.civicrm.org).</comments> </pl_PL> <pt_BR> ... </pt_BR> </localisedInfo> </extension>
It only supports name, description, maintainer and comments sections - all other extension information defined here will be ignored.
That's more or less everything about the info file. Got suggestions? Comments under this post await your voices. :-) Coming up next in a few days - step by step tutorial on packaging your extension.