Skip to content

Instantly share code, notes, and snippets.

@rajesh-h
Created December 23, 2014 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajesh-h/23ceca5c2cbf28d62f41 to your computer and use it in GitHub Desktop.
Save rajesh-h/23ceca5c2cbf28d62f41 to your computer and use it in GitHub Desktop.
/**
* Implements hook_menu().
*/
function module_categories_menu() {
var items = {};
items['categories_view'] = {
title:'Subscribed Products',
page_callback: 'module_categories_articles_page'
};
return items;
}
/**
* The page callback to display the view.
*/
function module_categories_articles_page() {
try {
var content = {};
content['my_categories_list'] = {
theme: 'view',
format: 'ul',
path: 'category-view', /* the path to the view in Drupal */
row_callback: 'module_categories_articles_list_row',
empty_callback: 'module_categories_articles_list_empty',
attributes: {
id: 'my_categories_list_view'
}
};
return content;
}
catch (error) { console.log('module_categories_articles_page - ' + error); }
}
/**
* The row callback to render a single row.
*/
function module_categories_articles_list_row(view, row) {
try {
/*return l(row.title, 'node/' + row.nid);*/
return l(row.name, 'taxonomy/term/' + row.tid);
}
catch (error) { console.log('module_categories_articles_list_row - ' + error); }
}
/**
*
*/
function module_categories_articles_list_empty(view) {
try {
return 'Sorry, no articles were found.';
}
catch (error) { console.log('module_categories_articles_list_empty - ' + error); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment