Issues

ZF-9530: Add generic 'link' tag ability to feed and entry

Description

As indicated by http://iana.org/assignments/link-relations/… - there are many link relations that may be given a feed or entry (at least in atom).

I propose a small addition that will add the method

{{public function addLink($href, $rel=null, $type=null, $title=null, $hreflang=null, $length=null);}}

per the spec http://atompub.org/rfc4287.html#element.link

Other extensions and method can then use this in their specific manner.

Comments

Here's a first-pass diff on adding this at the lowest level. I would assume most of the other link tags could use these functions. I'm just blindly assigning the attributes, might be good to order them and filter the attributes per the spec.

I'm considering just adding this to the Atom extension, mainly because it's useful for RSS too. Its not a real difficult one to add. I'll have to change up the renderer just a bit, but should be relatively lightweight.

For right now, I need this (just for Atom feeds) because I need to add a few 'related' links, and I need to be able to add a 'self' link to an Entry (for PubSubHubBub).

Thoughts?

Working on this soon! I may need to tweak the method name slightly to maintain consistency with the ZFR interface (we're trying to keep them synced for the next stage of development).

Added Zend_Feed_Reader to the component list. The way these are added, I'm trying to ensure every Writer addition has a relevant parser method on the Reader side. See comment later on a suggestion to that end.

Before adding this, I'm looking towards a generic link parser for Reader. Nothing mysterious, but it will likely become a getAllLinks() method. Unfortunately, getLinks is already taken (wish I had the foresight to have name it otherwise!). The new method would basically use the current Collection (ArrayObject) interface to return an array of arrays contain ALL detected Atom link elements' metadata. I'm also considering adding a findLinks() method accepting an array of constraints - so you can look up links whose metadata coincides with the given parameters. Parameters and return values would be restricted to Arrays or ArrayObjects (point of consistency for the future integration of Reader and Writer).

Since we are maintaining a consistent focus on arrays, the suggested method would have it's signature altered to accept a single array - the array keys would match all possible valid Link metadata points: href, rel, type, etc. I can add a new issue indicating where I should refactor current methods to focus on the new method rather than custom code.

Comments?

This sounds perfectly acceptable. applications of RSS/Atom feeds outside of plain ole readers really benefit from descriptive links, so I'm happy it will get attention.

Let me know if theres anywhere I can help out.