Skip to content

Deactivate matrix blocks per site #10830

Answered by brandonkelly
mihob asked this question in Q&A
Discussion options

You must be logged in to vote

That’s currently not possible, however you could pull it off by adding a custom “Enabled for site” Lightswitch field to each block type (defaults to enabled), and set it to be translatable for each site.

Then when querying Matrix blocks, only fetch the ones where that field is enabled:

{% set blocks = entry.myMatrixField
  .myEnabledForSiteHandle(true)
  .all() %}

Replies: 2 comments 15 replies

Comment options

You must be logged in to vote
1 reply
@mihob
Comment options

Answer selected by brandonkelly
Comment options

You must be logged in to vote
14 replies
@mihob
Comment options

@brandonkelly
Comment options

@brandonkelly
Comment options

@mihob
Comment options

@brandonkelly
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants