Aggregator module blocks - add '1' to news item # array

Created on 6 November 2007, about 17 years ago
Updated 7 September 2023, over 1 year ago

When adding my facebook status feed to my personal site just now I realised that a coding oversight restricts the automatic blocks created for aggregated feeds to a minimum of 2 posts.

Now, for something like showing your facebook status on a Drupal site, you probably only want to show one item - that being your latest status update, not the last 2 or 5 etc... So, you'll need to go to 'modules/aggregator' and edit your copy of the aggregator.module file.

Look around line 269 for the following code - I've added a '1' to the array - this allows the aggregator blocks to offer you a display of just the most recent feed item.

Note: I found this issue with Drupal 5.1 - it may have been corrected since then...

      $form['block'] = array('#type' => 'select', '#title' => t('Number of news items in block'), '#default_value' => $value, '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
      return $form;
✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada designguru

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MariaDB 10.3.22
    last update over 1 year ago
    148 pass
  • πŸ‡ΊπŸ‡ΈUnited States dcam

    I've been ignoring this simple issue because I want to do away with the block plugins in favor of a view. After that it won't be a problem anymore. But when I started working on the view today I realized that we'll need to leave the plugin in the module until version 3 is released for backward compatibility. That's because there may be instances of the blocks such as those in Layout Builder that can't be automatically replaced by an update function. So some sites may choose to continue using the plugin for a while. We may as well fix this for them.

  • Status changed to RTBC over 1 year ago
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
    +++ b/tests/src/Functional/AggregatorRenderingTest.php
    @@ -83,6 +83,17 @@ class AggregatorRenderingTest extends AggregatorTestBase {
    +  /**
    +   * Tests the elements of the AggregatorFeedBlock settings form.
    +   */
    +  function testBlockSettingsForm() {
    +    $this->drupalGet('/admin/structure/block/add/aggregator_feed_block/olivero');
    +
    +    foreach (range(1, 20) as $value) {
    +      $this->assertSession()->optionExists('edit-settings-block-count', $value);
    +    }
    +  }
    

    I am of the opinion that we don't need to test this, its a trivial change and we're wasting cpu cycles/time on each PR testing it, but happy for it to stay if you feel otherwise

  • πŸ‡ΊπŸ‡ΈUnited States dcam

    I am of the opinion that we don't need to test this, its a trivial change and we're wasting cpu cycles/time on each PR testing it

    I agree. I was just trying to be thorough. I'll remove it from the patch.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MariaDB 10.3.22
    last update over 1 year ago
    149 pass
    • dcam β†’ committed ad6c1159 on 2.x
      Issue #189935 by dcam, dafeder, larowlan: Aggregator module blocks - add...
    • dcam β†’ committed 4398b61c on 1.x
      Issue #189935 by dcam, dafeder, larowlan: Aggregator module blocks - add...
  • Status changed to Fixed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States dcam

    Thanks to everyone who worked on this!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024