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:
Cache setting “Block caching type” is not used in block instances. Instead DRUPAL_NO_CACHE is used.
How to reproduce:
- Create Views block display.
- Set cache to any value (except “Do not cache”).
- Save View.
- Place View block with any machine name.
- You can see placed block settings in sites/default/files/config_[hash]/active/block.block.bartik.[machine_name].yml
Cache setting with be always -1 (DRUPAL_NO_CACHE).
Now 'cache' and 'admin_label' is added via Drupal\views\Plugin\Derivative\ViewsBlock, but only admin label is added to settings by default: http://drupalcode.org/project/drupal.git/blob/50ae3296382669baebee8b9afa...
Solution:
Add cache setting in settings() method.
Comment | File | Size | Author |
---|---|---|---|
#11 | interdiff.txt | 2.54 KB | dawehner |
#11 | vdc-1987236.patch | 2.54 KB | dawehner |
#10 | vdc-1987236.patch | 2.54 KB | dawehner |
#7 | vdc-1987236-7.patch | 2.65 KB | dawehner |
#7 | interdiff.txt | 614 bytes | dawehner |
Comments
Comment #1
kalabroComment #3
kalabroFailed NodeAccessLanguageTest is not related to this patch.
Comment #4
msonnabaum CreditAttribution: msonnabaum commentedJust ran into this as well. This is clearly missing test coverage considering it's been broken this long.
Comment #5
dawehnerNote: never forget the VDC tag.
Comment #7
dawehnerIf ?: would just handle the isset case.
Comment #8
Wim Leers7: vdc-1987236-7.patch queued for re-testing.
Comment #9
damiankloip CreditAttribution: damiankloip commentedThat value will be defaulted in BlockBase anyway. I think this would be better as:
Otherwise, looks great.
Comment #10
dawehnerPERFORMANCE/REGRESSION HAMMER TIME!
Comment #11
dawehnerThat was the wrong patch.
Comment #12
jibranPatch is fine and tests show it is working. Great work @dawehner.
Comment #13
catchCommitted/pushed to 8.x, thanks!
Comment #15
YesCT CreditAttribution: YesCT commentedchanging to use the more common tag, so the less common one can be deleted, so it does not show up in the auto complete and confuse people.