Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
BlockPluginInterface
defines build()
method that is supposed to return an array.
However, AggregatorFeedBlock
returns NULL when configured feed is not loaded.
Proposed resolution
Return empty array when feed cannot be loaded.
Comment | File | Size | Author |
---|---|---|---|
#10 | 3212354-10.patch | 2.49 KB | guilhermevp |
Comments
Comment #2
Chi CreditAttribution: Chi commentedComment #3
guilhermevp CreditAttribution: guilhermevp at CI&T commentedA patch for it.
Comment #4
Chi CreditAttribution: Chi commentedThe patch includes a bunch of unrelated changes.
Comment #5
guilhermevp CreditAttribution: guilhermevp at CI&T commentedSorry for wrong patch.
Comment #6
Chi CreditAttribution: Chi commented@guilhermevp I would use early return instead of "else".
Example: https://git.drupalcode.org/project/drupal/-/blob/9.1.8/core/modules/help...
Comment #7
guilhermevp CreditAttribution: guilhermevp at CI&T commentedRight, makes sense. Thanks for the feedback!
Comment #8
Chi CreditAttribution: Chi commented@guilhermevp That's not early return but rather the opposite.
https://pear.php.net/manual/en/standards.bestpractices.php#standards.bes...
Comment #9
guilhermevp CreditAttribution: guilhermevp at CI&T commentedSorry, thanks again for the feedback.
Sending patch.
Comment #10
guilhermevp CreditAttribution: guilhermevp at CI&T commentedremoved indentation error.
Comment #11
Chi CreditAttribution: Chi commentedThank you.
Comment #15
catchDon't think it's useful to add an explicit test for this.
Committed/pushed to 9.3.x, cherry-picked to 9.2.x and 9.1.x, thanks!