I'm working with CiviCRM for the first time and having problems with layouts. 

All of my CiviCRM pages are using the default layout. How do I configure a custom layout for a specific set of CiviCRM pages. For example, I would like to create a custom layout for CiviCRM events, these pages all share the path /civicrm/event/*. However, I'm not sure which "context" to use - and I am required to select a context. 


It looks like "civicrm" is the context. I'm still not sure sure how I am supposed to know this, but it seems to be working for me. 

So far, this layout is working for civicrm pages with path civicrm/event/* - hopefully, that it is not working for anything else. 

See screenshot.

I don't have any answers yet Tim but maybe I will once I test this out again. I believe that it would take more work to create more fine grained contexts. Not obvious given that this is two different systems working together.

A related question. I was able to get a current path visibility condition for all events. But, I am trying to create a block to show up on a specific donation form and can't figure out how to do it. 

For example, how do I get a block to display on just this ONE page:

* civicrm/contribute/transact?reset=1&id=4

@stpaultim We may need to create some more granular visibility conditions (e.g. we've just added one for CiviCRM checksum links, we could conceivably add for checking the Contribution page or Event page).

Alternatively (and maybe more generally useful for Backdrop folks) this module could be ported and converted to work as Layout visibility conditions:

@laryn - Thanks for this update. I understand this to mean that visibility conditions for blocks will not currently work on some CiviCRM pages. 

Is there an alternative solution for customizing an event or contribution page? Other than adding a block with a visibility condition.

@stpaultim It's still in an alpha state but these aim to allow insertion of a contribution page or event registration page into a block or a field (so you would be able to use regular content URLs with nodes or terms, for example, and insert a contribution page into the content):

You can also use the CiviCRM-Webform integration if you are okay with not using the core CiviCRM interface and using a webform instead (so you could use core URL handling for the node that generates the webform):

I think using civicrm_blocks would be the best solution here. However, if the content is specific to the contribution page and does not need to appear elsewhere in the CMS, you can customize the contribution form directly in CiviCRM using an extension and Civi's buildForm hook

bugfolder's picture

CiviCRM distinguishes pages for different events, contribution forms, etc., via query parameters. So a layout or block visibility condition based on values in $_GET would allow one to target specific CiviCRM pages.