0

I am using the Aggregator module in Drupal 8 to combine several RSS feeds, but I would like to set a limit on the number of items that are shown from any one feed. How can I accomplish this?

0

This might not be the right way to do it but I solved this by using template_preprocess_aggregator_feed(&$variables) and then slice the items using array_slice().

My items were stored at $variables['content']['items'] but there were two other hashtag variables stored in the beginning of the array so I had to add that to the total count.

function template_preprocess_aggregator_feed(&$variables) {
  $number_of_items = 5;
  $variables['content']['items'] = array_slice($variables['content']['items'],0,2 + $number_of_items);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.