How to Configure the ATOM feed

Populate the Summary field with content from a particular field

function mymodule_pugpig_display_summary($node) {
  return pugpig_value($node, 'field_sell');

Determine the hierarchy of the nodes

// Cover and Index at level 1. Everything else at 2
function mymodule_pugpig_page_level($node) {
   if ($node->type == 'mymodule_index') return 1;
   return 2;

Content type name mappings for the feeds

function mymodule_pugpig_page_feed_type_name($node) {
  if ($node->type == 'ad_package') return 'screenshot';
  if ($node->type == 'mymodule_article') return 'article';

Sharing link from content type

function mymodule_pugpig_content_sharing_link($node) {
  $type = $node->type;
  $sharing_types = array('mymodule_product');
  if (!in_array($type, $sharing_types)) return null;
  return pugpig_full_web_url($node->nid);

Extra categories in the ATOM feed

If you need to insert some extra data into the feed, for example to style a section category in the native part of the app, you can insert a custom category.

// Extra categories for the ATOM feed
function mymodule_pugpig_page_custom_categories($node)  {
  $col = pugpig_value($node, 'field_section_colour');
  if (!empty($col)) {
    return array("colour" => $col);
  } else {
    return array("colour" => "#FFF640");

Extra links in the ATOM feed

If you have an edition level link that you need to pass up to the app, you can add it to the ATOM feed to make it easily available.

function mymodule_pugpig_page_links($node) {
      $links[] =   array(
        'rel' => "related",
        'title' => "Data XML Directory", 
        'type' => "application/data+xml", 
        'href' => "data/mytheme/data.xml"
      return $links;

Use a field in a node to populate the category

// Get the categories for index pages from the heading, or title as fallback
function mymodule_pugpig_page_categories($node) {
  $categories = array();
  if ($node->type == 'index') {
     array_push($categories, pugpig_value($node, 'field_heading', 'value', $node->title));
  return $categories;
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Powered by Zendesk