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
When you creat a block field for a view. This block is triggering notices when the view had no output:
Notice: Undefined index: #title in Drupal\ds\Plugin\DsField\DynamicBlockField->getTitle() (line 57 of /x/www/modules/contrib/ds/src/Plugin/DsField/DynamicBlockField.php).
This is because views is doing this:
// When view_build is empty, the actual render array output for this View
// is going to be empty. In that case, return just #cache, so that the
// render system knows the reasons (cache contexts & tags) why this Views
// block is empty, and can cache it accordingly.
if (empty($output['view_build'])) {
$output = ['#cache' => $output['#cache']];
}
Comment | File | Size | Author |
---|---|---|---|
#2 | 2678230-1-title_notice.patch | 612 bytes | nils.destoop |
Comments
Comment #2
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commentedFollowing patch fixes the issue.
Comment #3
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commentedComment #4
aspilicious CreditAttribution: aspilicious commentedComment #6
ademarco CreditAttribution: ademarco at Nuvole commentedThe problem reported by this issue is still there on current dev branch and the patch proposed at #2 actually solves it. I'm re-opening and marking this as RTBC for maintainers consideration.
Comment #8
aspilicious CreditAttribution: aspilicious commentedI forgot to push... Whoops