Announcements and feedapi (and possibly other content generators)

doompal - March 20, 2009 - 00:04
Project:Announcements
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:won't fix
Description

I have written a small module that selects (randomly-ish) announcements to appear in whatever region. I have been expirementing with Announcements and Feedapi. Announcements seem to be an obvious node type for Feedapi to create, appearing in a sidebar or whatever. The only problem is that without changes the abstract and publish dates will not be created. This can be done with another module but would it be more appropriate to amend Announcements to check and if necessary fill in these fields, bearing in mind that if Announcements is valued other modules may conceivably wish to create Announcements? Or maybe I should use views? Any advice would be appreciated. I would be prepared to do some coding, I'm not trying to dump something on anyone.

#1

NancyDru - March 21, 2009 - 13:52

One thing that I have been thinking about for some time is to do away with the abstract field entirely and just use the teaser (this is more reliable in 6.x than 5.x). It would take some careful coding, I think, and a lot of testing. I would think hook_load could grab the current teaser and move it into the abstract field and hook_save could force it back.

A random announcements block would not be hard to add as I have a similar block in other modules (Quotes and Weblinks come to mind). It was just not my original idea that one might want to show them randomly. I would be interested in hearing your use case on this.

"Publish dates will not be created" - this wouldn't be that hard to address, I think. We already have a default interval that could be filled at hook_save if it is not present.

If you wish to work on a patch, there's some ideas.

#2

bdornbush - March 21, 2009 - 18:15

I would encourage you to leave the abstract field and body field separate as they are now. I often find that I want to put something in the abstract that is not just the first part of the body field in order to provide a meaningful summary for the home page block.

#3

doompal - March 21, 2009 - 22:43

I was looking at another CMS and noticed that the header was not always the same when I reloaded the page. It was posting a block in the header that highlighted bit of news or features or whatever. It struck me that this could be useful on commercial sites, "Sale Now On", "This Month's Choice", or (as I was interested in) pointing to a major news item concerned with open software (this month's Winbuntu release not named after silly animal etc.). Rather than start from scratch I stole a load of code from Announcements, which I had come across in the IBM article and had started converting before thinking that someone else may have got there first. The module I knocked together selects x-number of Announcements and chooses one to display (randomly, though I suppose it should be weighted), although the front page one can be fixed. I don't know whether this would be useful to the Drupal community.

As for Announcements in general: as I said they look perfect recipients for RSS feeds. I see bdornbush wants to keep the abstract. Maybe it would be possible to make abstract optional but, if missing, display the teaser, or at some point copy the teaser into the empty abstract field?

#4

NancyDru - April 15, 2009 - 21:06
Status:active» postponed (maintainer needs more info)

I'd love to see what you came up with.

#5

doompal - April 28, 2009 - 21:41

It can be done. I put together a module that puts abstracts and dates into announcements that didn't have one. Seems to work. If this would be useful I can try to put together a more general solution.

#6

NancyDru - April 29, 2009 - 03:32

Yes, please do it.

#7

NancyDru - October 1, 2009 - 05:09
Status:postponed (maintainer needs more info)» won't fix

No patch submitted. Please reopen this issue if you create one.

 
 

Drupal is a registered trademark of Dries Buytaert.