This project is not covered by Drupal’s security advisory policy.
Paragraphs Condition lets you show or hide a block depending on what a page is made of, rather than on what kind of page it is. It adds a "Paragraph type" visibility condition: the block appears when the page you are viewing contains a paragraph of one of the types you pick.
When you need it
On a site built with Paragraphs, some pages are not really "a content type". They are a landing page, or a basic page, assembled out of components: one holds a search, another a map, another a directory. They all share the same content type with hundreds of ordinary pages, but each needs its own blocks, its own facets, its own sidebar.
You probably want this module if any of these sounds familiar:
- You keep adding paths to a block's "Pages" setting every time an editor publishes a new page.
- You cannot use the "Content type" condition because the pages you want to target share their content type with everything else.
- You created a content type whose only purpose was to make a block appear.
- An editor moved or renamed a page and a block quietly disappeared from it.
This condition targets the thing that actually makes those pages different, which is the component they are built from. Pages created later work on their own, with nobody touching the block configuration.
How it works
The condition looks at the whole component tree of the page, so a paragraph nested inside another one counts. That matters on the usual setup where a layout component, a "Section" or a "Row", holds the components that do the real work.
It is not limited to nodes. Taxonomy term pages, media pages and any other entity your site defines work the same way, so a single block can be shown on a node page and on a term page with one condition.
What you can configure
Paragraph types. The components the condition looks for. Pick several and the block appears when the page holds any one of them. Pick none and the condition does nothing, so a half configured block is never accidentally hidden everywhere.
Entity types and bundles. Optional, and worth filling in. It narrows the condition to the pages that can possibly matter, written one per line as node:landing_page, or as just user to cover every bundle of an entity type. Besides letting you say "this component, but only on landing pages", it keeps the condition cheap: on every other page of the site the answer is a string comparison, with no components loaded at all. What you type is checked when you save the block, so a mistyped machine name is reported instead of silently matching nothing.
Negate the condition. The standard checkbox, for hiding a block precisely on the pages that contain a given component.
Requirements
This module requires the Paragraphs module.
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.- Project categories: Access control, Site structure
- Created by trebormc on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
