Skip to content

Commit

Permalink
Set separate result limit in RSS from Display page (#364)
Browse files Browse the repository at this point in the history
* Add RSS limit option

* Add variable to install file
  • Loading branch information
bondjimbond authored and DiegoPino committed Jun 3, 2019
1 parent e5cd8aa commit 97a6c0a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
11 changes: 9 additions & 2 deletions islandora_solr_config/includes/admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function islandora_solr_config_admin_rss_settings($form, &$form_state) {
'managingEditor' => '',
'webMaster' => '',
));
$rss_limit = variable_get('islandora_solr_config_rss_limit', 50);

$form = array(
'#tree' => TRUE,
Expand Down Expand Up @@ -110,6 +111,12 @@ function islandora_solr_config_admin_rss_settings($form, &$form_state) {
'#description' => t('Email address for person responsible for technical issues relating to channel.'),
'#default_value' => $rss_channel['webMaster'] ? $rss_channel['webMaster'] : '',
);
$form['rss_limit'] = array(
'#type' => 'textfield',
'#title' => 'RSS results limit',
'#description' => 'Maximum number of results via RSS.',
'#default_value' => $rss_limit,
);
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
Expand All @@ -120,7 +127,6 @@ function islandora_solr_config_admin_rss_settings($form, &$form_state) {
'#value' => t('Reset to defaults'),
'#weight' => 51,
);

return $form;
}

Expand All @@ -135,10 +141,11 @@ function islandora_solr_config_admin_rss_settings_submit($form, &$form_state) {
// Get values.
$rss_item = $form_state['values']['rss_item'];
$rss_channel = $form_state['values']['rss_channel'];

$rss_limit = $form_state['values']['rss_limit'];
// Set variable.
variable_set('islandora_solr_config_rss_item', $rss_item);
variable_set('islandora_solr_config_rss_channel', $rss_channel);
variable_set('islandora_solr_config_rss_limit', $rss_limit);
}

// On reset.
Expand Down
2 changes: 2 additions & 0 deletions islandora_solr_config/includes/rss_results.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class IslandoraSolrResultsRSS extends IslandoraSolrResults {
global $base_url;

drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8');
$islandora_solr_query->solrLimit = variable_get('islandora_solr_config_rss_limit', 50);
$islandora_solr_query->executeQuery();

// Get raw results.
$solr_result = $islandora_solr_query->islandoraSolrResult;
Expand Down
1 change: 1 addition & 0 deletions islandora_solr_config/islandora_solr_config.install
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function islandora_solr_config_uninstall() {
$variables = array(
'islandora_solr_table_profile_display_row_no',
'islandora_solr_table_profile_table_class',
'islandora_solr_config_rss_limit',
);
foreach ($variables as $variable) {
variable_del($variable);
Expand Down

0 comments on commit 97a6c0a

Please sign in to comment.