Now that Open Atrium 2 is in BETA release, I've been getting more questions about how to extend functionality in Open Atrium (OA2) and how to create plugins. I'll be answering these questions and giving an instructional demo of this during the inaugural Drupal Association webinar this Wednesday (Aug 21st). You can register for this exciting webinar here. Here is a summary of what I'll be discussing:
How to Add Functionality
During the webinar demo, I will be creating a basic 'Task' functionality. A new section type called 'Tasks' will be created that allows users to create 'New Tasks' and the ability to show a listing of assigned tasks and due dates.
How To Create A Content Type
The first step in adding functionality is creating a new Content Type called 'Task'. Add fields for 'Due Date' and 'Assigned to User'. As mentioned in the Open Atrium Technical Documentation, the next step is to add the 'Group Audience' and 'Section Reference' fields. Now the Task content is integrated with the OA2 access control system.
Create A View
To display a list of tasks, we need to create a new View. Since we are using Panels, we want to create a "Content Pane" view. We'll add the 'Title', 'Due Date', and 'Assigned To' fields to the display. To integrate the View with OA2, we then add 'Exposed Filters' for both the 'Group Audience' and 'Section Reference' fields. Finally, in the 'Allowed Settings' we enable 'Use exposed widgets form as pane configuration', 'Exposed Form"' and 'Fields Override' and set both the 'Group Audience' and 'Section Reference' filters to 'Pane configuration form and exposed form'. This will allow the Space and Section filters to be set either in the Panel widget configuration, or by the user as exposed filters.
Create A Section Type
To create a new section layout, we go to the Panelizer configuration and select the 'list' link for Section Pages. This shows the list of existing Panelizer layouts. Rather than starting from scratch, we can clone an existing layout, such as the 'News Section'. We'll call our new layout 'Task Section' and in the content settings, we'll replace the 'Recent News' widget with the new 'Task View' that we just created. When adding the Task View, we select 'Active Space' and 'Active Section' for the Space and Section filters, then change the display to a Table and enable the exposed filters. Next, we go to the Section Type taxonomy and add a new term for Task Section that uses the new Panelizer layout we just created to enable the Tasks in the list of allowed content types.
Testing The Tasks
Our new Task functionality is ready to use! We can go to one of our Spaces and create a new Section Page and give it a type of 'Task Section'. Then we can create new Tasks within the section and see them displayed on the section page. We can also add our new Task View to the top-level Space page to show all of the tasks within the space.
Saving Our Work
Once we have tested our new Task functionality, it's time to save our work as a new plugin module. We use Features to save our Task content type, fields, view, Panelizer layout and taxonomy terms to a new module. This module can be installed on any OA2 site to add basic Task functionality. This is a very simple example of extending Open Atrium 2 using normal Drupal site-building methods and without writing any code. This functionality could be expanded even further but this should give you an idea how easy it is to add new functionality to OA2. I hope you join me on Wednesday August 21st for the first Drupal Association webinar: "Plugging in to Open Atrium 2.0 - Extending OA 2.0's Capabilities"