summaryrefslogtreecommitdiff
path: root/modules/aggregator
diff options
context:
space:
mode:
Diffstat (limited to 'modules/aggregator')
-rw-r--r--modules/aggregator/aggregator.install7
-rw-r--r--modules/aggregator/aggregator.pages.inc2
-rw-r--r--modules/aggregator/aggregator.processor.inc15
3 files changed, 23 insertions, 1 deletions
diff --git a/modules/aggregator/aggregator.install b/modules/aggregator/aggregator.install
index d6a811313..9d3733312 100644
--- a/modules/aggregator/aggregator.install
+++ b/modules/aggregator/aggregator.install
@@ -28,6 +28,7 @@ function aggregator_uninstall() {
variable_del('aggregator_fetcher');
variable_del('aggregator_parser');
variable_del('aggregator_processors');
+ variable_del('aggregator_teaser_length');
}
/**
@@ -280,3 +281,9 @@ function aggregator_update_7000() {
db_add_field($ret, 'aggregator_feed', 'hash', array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''));
return $ret;
}
+/**
+ * Add aggregator teaser length to settings from old global default teaser length
+ */
+function aggregator_update_7001() {
+ variable_set('aggregator_teaser_length', variable_get('teaser_length'));
+}
diff --git a/modules/aggregator/aggregator.pages.inc b/modules/aggregator/aggregator.pages.inc
index 16cd6cf70..5c5d0c70c 100644
--- a/modules/aggregator/aggregator.pages.inc
+++ b/modules/aggregator/aggregator.pages.inc
@@ -378,7 +378,7 @@ function theme_aggregator_page_rss($feeds, $category = NULL) {
foreach ($feeds as $feed) {
switch ($feed_length) {
case 'teaser':
- $teaser = node_teaser($feed->description);
+ $teaser = node_teaser($feed->description, NULL, variable_get('aggregator_teaser_length', 600));
if ($teaser != $feed->description) {
$teaser .= '<p><a href="' . check_url($feed->link) . '">' . t('read more') . "</a></p>\n";
}
diff --git a/modules/aggregator/aggregator.processor.inc b/modules/aggregator/aggregator.processor.inc
index a2ff818c8..567db2634 100644
--- a/modules/aggregator/aggregator.processor.inc
+++ b/modules/aggregator/aggregator.processor.inc
@@ -112,10 +112,25 @@ function aggregator_form_aggregator_admin_form_alter(&$form, $form_state) {
'select' => t('multiple selector')),
'#description' => t('The type of category selection widget displayed on categorization pages. (For a small number of categories, checkboxes are easier to use, while a multiple selector works well with large numbers of categories.)'),
);
+ $form['modules']['aggregator']['aggregator_teaser_length'] = array(
+ '#type' => 'select',
+ '#title' => t('Length of trimmed description'),
+ '#default_value' => 600,
+ '#options' => drupal_map_assoc(array(0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000), '_aggregator_characters'),
+ '#description' => t("The maximum number of characters used in the trimmed version of a description. Drupal will use this setting to determine at which offset long descriptions should be trimmed. Note that this setting will only affect new or updated content and will not affect existing teasers.")
+ );
+
}
}
/**
+ * Helper function for teaser length choices.
+ */
+function _aggregator_characters($length) {
+ return ($length == 0) ? t('Unlimited') : format_plural($length, '1 character', '@count characters');
+}
+
+/**
* Add/edit/delete an aggregator item.
*
* @param $edit