Closed (fixed)
Project:
Twig Tweak
Version:
3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
5 May 2021 at 12:20 UTC
Updated:
19 May 2021 at 14:04 UTC
Jump to comment: Most recent, Most recent file
Some blocks plugins return NULL in build() method, eg \Drupal\aggregator\Plugin\Block\AggregatorFeedBlock::build(). Because of this, an fatal error:
TypeError: Argument 1 passed to Drupal\Core\Render\Element::isEmpty() must be of the type array, null given, called in modules\contrib\twig_tweak\src\TwigExtension.php on line 476 in Drupal\Core\Render\Element::isEmpty() (line 198 of core\lib\Drupal\Core\Render\Element.php).
Text error from 2.x version
1. Create block plugin with:
public function build() {
return NULL;
}
2. Add in twig file:
{{ drupal_block('block_with_null') }}
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3212340_1.patch | 553 bytes | xandeadx |
Comments
Comment #2
xandeadx commentedComment #3
xandeadx commentedComment #4
chi commentedThat's a bug in Aggegator module. The
build()method should always return an array perBlockPluginInterfacedeclaration.Comment #6
chi commentedThank you.