Follow

How to Configure Categories

The way the system looks for categories is:

  1. Look for a field on the content item called field_pugpig_categories, and use the first value it finds as the category
  2. If this field doesn't exist, call the hook pugpig_page_categories and use any values this returns
  3. If the hook returns nothing, look for a category on any parent pages - See How to Configure a Page Hierarchy

You should check the categories are as expected in the 'http://schema.pugpig.com/section' part of the ATOM feed. For example:

News Story 1
    newsstory1

Selecting the scheme

The Drupal connector includes the section category, but will also include categories for the page type and more. The Pugpig clients will use the first category they see in the ATOM feed. If you want to force the client to only use the section category, see How to Using the Section Category

Sample Hooks

Below is an example hook that will mean that field_section is used as the categories.

 /**
 * Implements hook_pugpig_page_categories().
 */
 
function mymodule_pugpig_page_categories($node) {
  $categories = array();
 
  if (property_exists($node, 'field_section')) {
    if (array_key_exists('und', $node->field_section))
      foreach ($node->field_section['und'] as $val) {
        $categories[] = $val['value'];
      }
  }
}

Below is an example hook that will mean that field_heading is used as the category for pages of type index.

/**
 * Implements hook_pugpig_page_categories().
 */
 
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

Comments

Powered by Zendesk