So I'm trying to help get commentrss integrated with syndication, but as easy as I thought it would be, the documentation is confusing the hell out of me. Here's how I've tried to learn:
1. Read the README.txt. It tells me "Also, modules may insert their own boxes onto this page using hook_syndication. See Help for details." There is no help section or anything on the hook in the README.txt. WTF.
2. Look for the hook documentation in a file possibly named syndication.api.php. No such file found.
3. Read syndication.module. Realize the 'Help' in the README.txt means the syndicaiton_help pages on the site and not anything in the code. I'm not ready to enable the syndication module yet. Why force me to do that in order to read hook documentation?
4. Finally look at the *bottom* of the module file and find it and I'm still confused as to how this hook has to do with RSS feeds at all. According to the example, syndication is not going to know anything about the paths to the RSS feeds the my module provides.
/**
* Allows modules to add RSS feeds to the Syndication page
*
* Any module can export boxes to the syndication page. You do so
* by creating a <i>modulename</i>_syndication function which returns
* an associative array of boxes, much like the block module. Each box
* in the array requires <i>subject</i> and <i>content</i> fields. Example:
* function mymodule_syndication() {
* $box[0]["subject"] = "Existentialism";
* $box[0]["content"] = "So many feeds in this world";
*
* $box[1]["subject"] = "Got any question?";
* $box[1]["content"] = "Who, Where, Why, When";
* return $box;
* }
*/
function hook_syndication() {
// Creating the first box
$box[0]["subject"] = "Existentialism";
$box[0]["content"] = "So many feeds in this world";
// Lets create a one box more
$box[1]["subject"] = "Got any question?";
$box[1]["content"] = "Who, Where, Why, When";
return $box;
}
This is frankly, not helpful at all. Can someone please help me figure out how this hook works and can something please be done about the documentation? Please?
Comments
Comment #1
aaron1234nz commentedHi Dave,
I agree with you. I don't think that API documentation has been looked at for some time (probably since D4.6 days I would guess).
I've committed some changes which make this far easier to follow. The documentation is now in the readme file rather then the source code.
API
-----
This module provides a hook which allows other modules to show feeds on the Syndication page.
To implement this module create a function called mymodule_syndication() in the following format.
If the module provides many feeds you may with to group them. To do this simply provide more than one item in the $feed array.
Once you have done this, you will need to visit the admin/content/syndication page and enable the new feeds,
function hook_syndication() {
$feed[0]["subject"] = "Feeds from my new module";
$feed[0]["content"] = l('Feed one', 'mymodule/1/feed'). '
';
$feed[0]["content"] .= l('Feed two, 'mymodule/2/feed');
return $feed;
}