--- a/commentrss.admin.inc +++ b/commentrss.admin.inc @@ -21,12 +21,30 @@ '#description' => t('Where should the site comment feed be exposed, if at all enabled. If enabled, feed will be accessible at @url.', array('@url' => url('crss', array('absolute' => TRUE)))), '#default_value' => variable_get('commentrss_site', COMMENTRSS_SITE_FRONT_PAGE), ); - $form['commentrss_node'] = array( + + $form['individual_comment_feeds'] = array( + '#type' => 'fieldset', + '#collapsible' => TRUE, + '#collapsed' => FALSE, + '#title' => t('Individual comment feeds'), + ); + + $form['individual_comment_feeds']['commentrss_node'] = array( '#type' => 'checkbox', '#title' => t('Enable individual comment feeds for each post on the website'), '#description' => t('Feeds will be accessible on @url type of URLs.', array('@url' => url('crss/node/...', array('absolute' => TRUE)))), '#default_value' => variable_get('commentrss_node', TRUE), ); + + $form['individual_comment_feeds']['commentrss_node_type'] = array( + '#type' => 'select', + '#options' => node_type_get_names(), + '#title' => t('Filter the individual feeds by content type'), + '#description' => t('Select the contenty type that will show individual feed icon. If blanck, it will show in all content type.'), + '#default_value' => variable_get('commentrss_node_type', array()), + '#multiple' => TRUE, + ); + $form['commentrss_term'] = array( '#type' => 'checkbox', '#title' => t('Enable individual comment feeds for each taxonomy term listing on the website'), --- a/commentrss.install +++ b/commentrss.install @@ -13,6 +13,7 @@ variable_del('commentrss_site'); variable_del('commentrss_node'); variable_del('commentrss_term'); + variable_del('commentrss_node_type'); } /** --- a/commentrss.module +++ b/commentrss.module @@ -145,11 +145,14 @@ */ function commentrss_node_view($node, $view_mode = 'full', $langcode = NULL) { if ($view_mode == 'full' && node_is_page($node) && commentrss_node_feed_access($node, FALSE)) { - // Expose node's comment feed on node view page. - drupal_add_feed( - url('crss/node/' . $node->nid, array('absolute' => TRUE)), - t('Comments for "@title"', array('@title' => $node->title)) - ); + $commentrss_node_type = variable_get('commentrss_node_type', array()); + if (count($commentrss_node_type) == 0 || in_array($node->type, $commentrss_node_type)) { + // Expose node's comment feed on node view page. + drupal_add_feed( + url('crss/node/' . $node->nid, array('absolute' => TRUE)), + t('Comments for "@title"', array('@title' => $node->title)) + ); + } } elseif ($view_mode == 'rss' && commentrss_node_feed_access($node, FALSE)) { // Add a wfw:commentRss element to the node when viewed in a node RSS feed.