The Nitty-gritty of Open Atrium

Drupal Context

A context basically means making a section of a drupal site work dynamically. For example, instead of manually entering the path you want a block to show up, the context module can be used to make this happen as well as make it exportable as a feature.


Context is all about defining contexts by assigning conditions that should be met in order to consider that context active, and reactions that should happen when a context is active.



When you are creating a features, you need to export along all the custom views, taxonomy, node types, cck fields and extra variables (strongarm) you have created. You will have to implement the export hooks of each of these objects in your .module file. You do this export in your .info file. This is the basis of features as well as the difference between features and a module. But still, a features is still a module, but an exportable module.


For example, if you create a custom view on a site and you want to replicate it on another site (i.e turn it into a feature), export the view using the views UI export and place the code in your module's Preferably, one can achieve this by entering in the .info file 'features[views][] = "view name"'.  You can alternatively use the UI at admin/build/features/create. With this entry the Features engine will automatically create the necessary codes into


More Features notes

  • Recreate is the same as running drush features-update [feature name]
  • When you add more codes to your feature, the State changes from Default to Overriden. Default means "raw code as generated by drush".


Drupal spaces

Spaces allows you to create features which you can make into multiple instances and then make use of in different contexts.


A feature enabled within a certain space (in the case of groups, a certain Organic Group group) contains unique content and even settings/configuration (depending on what the feature itself is built to allow).


The PHP users group can enable the Atrium Book feature, write unique content in their book which won't appear in the Python group, and also change a setting for Atrium Book to make a particular page within the note book the landing page of their note book. The Python group can set their Atrium Book feature to show a summary of changes in the notebook as the landing page for their Atrium Book feature. Spaces is what empowers a feature to be turned on and customized multiple times within a Drupal site.


The Spaces Dashboard feature is an example of a feature that works in the user space (as well as the group and site spaces) which lets each user customize what they see on their personal dashboard.


Every dashboard in Atrium is controlled by spaces module i.e Group dashboard (og), User dashboard (user).


Content is made available to the Dashboard using the core blocks system. The dashboard must be told what blocks it should offer. To make certain blocks available to spaces of a certain type (be it og, user or taxonomy) you must add this setting to a spaces preset.



The Strongarm module allows Drupal variables to be exported to code. In other words, instead of having to go to every single content type you created and turning off file attachments, turning on commenting, shutting off "promoted to front page", etc. etc., you can define all of these settings in code.


The one important capability to be aware of is hook_strongarm_alter which will let you alter the default settings provided by other modules. This is useful if you want to override a setting provided in Atrium core;


Blocks & Context

In Atrium, blocks are the same as usual. That is, create your block as always. The function of context in blocks is that;


Context is used to place these blocks in desired regions instead of enabling the block(s) in the block UI. The power in using Context to control the placement of blocks is that you can assign conditions that should be met in order to consider that context active as well as assign reactions that should happen when a context is active.


Context & Features

Context & Features used together can bring about fantastic results. Views, Blocks, Taxonomy, Menu, Themes, Path, Node type, User role, User page objects are all available to be used as context.


In order to set blocks in default regions (i.e make block available in a region by default), place the block in the region by hand using context, then export the context and make it into a feature. Enable the feature on another site and have your block set in the region you specified.


Spaces & Features

Spaces helps to control access to various features of a drupal site. For example, assuming you have a sales group and a marketing group on a drupal site. Then you decide to create a sales taxonomy for sales group. You can restrict the sales taxonomy to be available only to sales group using spaces. That is, you can turn on the sales taxonomy feature only for sales group. With spaces, you can create powerful intranet websites. [Very interesting]


When you create feature, you use spaces to create numerous instances of it.


Spaces vs Context

Spaces = multiple instances of features. Makes your multiple drupal site make use of og, taxonomy and user objects independently.


Context = make a section or block of your site work dynamically and export is as a feature.

Post new comment

The content of this field is kept private and will not be shown publicly.