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

Issue Type: Improvement Created: 2010-03-24T09:07:43.000+0000 Last Updated: 2012-11-20T21:38:04.000+0000 Status: Open Fix version(s): Reporter: Justin Hart (onyxraven) Assignee: None Tags: - Zend_Feed_Reader

  • Zend_Feed_Writer

Related issues: Attachments: - atomlinks.diff


As indicated by… - 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

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


Posted by Justin Hart (onyxraven) on 2010-04-02T15:40:02.000+0000

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.

Posted by Justin Hart (onyxraven) on 2010-04-05T09:20:17.000+0000

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).


Posted by Pádraic Brady (padraic) on 2010-05-04T06:35:57.000+0000

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).

Posted by Pádraic Brady (padraic) on 2010-05-05T09:45:47.000+0000

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.

Posted by Pádraic Brady (padraic) on 2010-05-05T09:53:32.000+0000

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.


Posted by Justin Hart (onyxraven) on 2010-05-26T08:41:39.000+0000

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.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.