I am wondering why the last two entries do not work:
public function getCacheTags() {
$tags = [
'node:270',
'node:271',
'node:273',
'node:282',
'block:customblockname',
'block:7',
];
$cacheTags = Cache::mergeTags(parent::getCacheTags(), $tags);
return $cacheTags;
}
When I edit my custom block the URL is:
/block/7?destination=/admin/structure/block/block-content
The actual id of the block (for instance when embedding it) is customblockname
.
What are the correct cache tags to include that block in my caching?
cachetags
. Opening that makes me believe blocks are named like this:config:block.block.bartik_branding
Where bartik_branding is the system name. So I suppose the pattern to beconfig:block.block.SYSNAME
. You should however be able to use thegetCacheTags()
method on the block entity. That should always work.'block_content:7',
:)