Follow

How to Add Additional feeds

Additional feeds can be added so different apps can point at different feed. This can be done by defining filters and filtering out editions based on these.

Simply define a default filter for your main editons.xml feed:

function mycustomapp_pugpig_opds_default_edition_filter() {
  return 'mycustomapp_default_filter';
}

Add other filters:

function mycustomapp_pugpig_feed_content_filters($filters) {
  $filters[] = 'green';
  $filters[] = 'blue';

  return $filters;
}

The above will have feed structured editions-green.xml and editions-green-atom.xml.

Then add some logic to filter out editions based on the above filters:

function mycustomapp_pugpig_filter_edition($edition, $edition_filter) {
$edition_type = pugpig_value($edition, 'field_edition_type');
if ($edition_filter === 'green') {
  if ($edition_type !== "green") return TRUE;
}
if ($edition_filter === 'blue') {
  if ($edition_type !== "blue") return TRUE;
}
return FALSE;
}

Each edition will be called through this hook. To filter out an edition return (bool)TRUE.

You should be able to see your new feeds under the Admin -> Pugpig -> Feeds tabs.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk