Simple Spaces Recipe for a Static Welcome Widget
One of the little conundrums in OpenAtrium (and I imagine in Spaces) is building static content for the space. (Or in OpenAtrium terms, getting a nice dashboard box to stay put, yet be customizable by group.)
There are countless ways of doing this, but I opted to create a CCK Textarea field in my group content type (named field_group_welcome_message) and turn on the PHP filter.
Then I created a Box (which is what OpenAtrium uses, could just as well have been a block) using the following snippet:
$space = spaces_get_space(); $text = $space->group->field_group_welcome_message[0]['value']; if ($text != NULL) { $format = $space->group->field_group_welcome_message[0]['format']; $text = check_markup($text, $format, '', TRUE); } else { $text = $space->group->og_description; } print $text;
The bit about $format and check_markup is only relevant if you turn on input filtering for your textarea. Can’t figure why you would not do that. UPDATE: Added a check for a null welcome message. If there is none, the group description will be inserted.
Now, whenever anyone goes to edit the group node/group settings, they are also offered the chance to play with the welcome message. You could just as well use this technique to pull out the Body of the group node, if that’s available. In OpenAtrium it’s removed, since it doesn’t fit into the dashboard concept without this kind of magic.
You could just as easily build some kind of zany view to achieve the same result, but you’d still need to do something to mark your target content uniquely. This method seems the most straightforward for the end-user.
I will update this another time with information about enabling such a block by default.