Commit c27b024c authored by Cody Craven's avatar Cody Craven
Browse files

Issue #1126052 by codycraven: Added option for administrator to omit RSS feeds...

Issue #1126052 by codycraven: Added option for administrator to omit RSS feeds from being generated automatically on taxonomy term pages.
parent eafba918
......@@ -2,6 +2,11 @@
Taxonomy Display 7.x-1.x, YYYY-MM-DD
------------------------------------
Taxonomy Display 7.x-1.0-alpha2, 2011-04-18
-------------------------------------------
Issue #1126052 by codycraven: Added option for administrator to omit RSS feeds
from being generated automatically on taxonomy term pages.
Issue #1124168 by codycraven: Fixed fatal error on taxonomy term display page
configuration when Display Suite not installed and enabled.
Issue #1122992 by codycraven: Fixed fatal error on taxonomy term display page
......
......@@ -69,6 +69,14 @@ function taxonomy_display_admin_form(&$form, &$form_state) {
_taxonomy_display_admin_form_build_plugin_form('term', $fieldset, $values, $stored_settings);
_taxonomy_display_admin_form_build_plugin_form('associated', $fieldset, $values, $stored_settings);
// Add selection for adding taxonomy term core feed to page
$fieldset['add_feed'] = array(
'#default_value' => $stored_settings['add_feed'],
'#description' => 'Drupal, by default, includes a feed of content referencing the term, by unchecking this you can prevent the feed from being added.',
'#title' => 'Include feed',
'#type' => 'checkbox',
);
// Add our #validate and #submit callback which will call plugins' methods.
$form['#validate'][] = 'taxonomy_display_admin_form_validate';
$form['#submit'][] = 'taxonomy_display_admin_form_submit';
......@@ -131,10 +139,11 @@ function taxonomy_display_admin_form_submit($form, &$form_state) {
$save_data['associated_display_options'] = $associated_display->formSubmit($td_form['associated_display_form'], $values['associated_display_form']);
}
// Save the add_feed setting.
$save_data['add_feed'] = $values['add_feed'];
// Save data
if (!empty($save_data)) {
taxonomy_display_save_taxonomy_display($form['#bundle'], $save_data);
}
taxonomy_display_save_taxonomy_display($form['#bundle'], $save_data);
}
/**
......
......@@ -76,6 +76,13 @@ function taxonomy_display_schema() {
'serialize' => TRUE,
'description' => 'The plugin data for the associated content display.',
),
'add_feed' => array(
'type' => 'int',
'not null' => TRUE,
'size' => 'tiny',
'default' => 1,
'description' => 'Whether to add Drupal\'s core feed.',
),
),
'primary key' => array('machine_name'),
);
......@@ -100,3 +107,19 @@ function taxonomy_display_update_7001() {
->condition('name', 'taxonomy_display')
->execute();
}
/**
* Implements hook_update_N().
*/
function taxonomy_display_update_7002() {
// Add feed field on taxonomy_display records in the storage system to give
// administrative control of whether the feed should be added to term pages
// see http://drupal.org/node/1126052
db_add_field('taxonomy_display', 'add_feed', array(
'type' => 'int',
'not null' => TRUE,
'size' => 'tiny',
'default' => 1,
'description' => 'Whether to add Drupal\'s core feed.',
));
}
\ No newline at end of file
......@@ -66,6 +66,7 @@ function taxonomy_display_fetch_taxonomy_display($machine_name) {
'term_display_options' => NULL,
'associated_display_plugin' => 'TaxonomyDisplayAssociatedDisplayHandlerCore',
'associated_display_options' => NULL,
'add_feed' => 1,
'no_record' => TRUE,
);
}
......@@ -245,6 +246,7 @@ function taxonomy_display_save_taxonomy_display($machine_name, $save_data = arra
case 'machine_name':
case 'term_display_plugin':
case 'associated_display_plugin':
case 'add_feed':
$query_fields[$k] = $v;
break;
case 'term_display_options':
......@@ -320,6 +322,9 @@ function taxonomy_display_save_taxonomy_display($machine_name, $save_data = arra
* The page content.
*/
function taxonomy_display_taxonomy_term_page($term) {
// Load settings for this vocabulary term.
$display_settings = taxonomy_display_fetch_taxonomy_display($term->vocabulary_machine_name);
// Build breadcrumb like core does, we could make this alterable in the future
// especially if something like custom breadcrumbs tells us how they would
// like to alter this.
......@@ -335,13 +340,15 @@ function taxonomy_display_taxonomy_term_page($term) {
$breadcrumb[] = l(t('Home'), NULL);
$breadcrumb = array_reverse($breadcrumb);
drupal_set_breadcrumb($breadcrumb);
drupal_add_feed('taxonomy/term/' . $term->tid . '/feed', 'RSS - ' . $term->name);
// Conditionally add core Drupal feed to page
if ($display_settings['add_feed']) {
drupal_add_feed('taxonomy/term/' . $term->tid . '/feed', 'RSS - ' . $term->name);
}
// Build our content
$build = array();
$display_settings = taxonomy_display_fetch_taxonomy_display($term->vocabulary_machine_name);
// Term display
$term_display = new $display_settings['term_display_plugin'];
$build['term_heading'] = $term_display->displayTerm($term, $display_settings['term_display_options']);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment