I've been spending a lot of time in the Civi galaxy learning the ropes. Now I am moving back to the drupal galaxy. I know they reside in the same universe and there are some blocks pre-built to expose Civi to Drupal.

Users are one area with overlap.

But Views... I see some pre-built civi views for me to place in Drupal. Where are they defined??

There is a pre-built view for upcoming events and I would like to tweak that to only show upcoming events where event type ==x.

Any help would be appreciated! Thanks


It's not a "view" in the drupal meaning of the word. It's coming from here: https://github.com/civicrm/civicrm-core/blob/6960dd4c1e5e99f8e0b3564dcc15269184d7702d/CRM/Core/Block.php#L523

I think the "right" way to customize this would be with your own drupal module that creates a block that does the same thing but calls that CRM_Event_BAO_Event::getCompleteInfo(date("Ymd")); function with the 2nd parameter which allows you to specify type.

I don't know if there's a hook that would allow you to more easily customize it in a supported way. If you want to hack it, just add a second parameter on that line to specify the type.

UPDATE: You could also do this as a drupal "view" if you install civicrm_entity. Views can be displayed as blocks.

  • You think thatif I edit my version of that blob and refresh my D8 cache then the my new pseudo block will show up as a block to add to a layout (like the current ones)? /** * The following blocks are supported. * * @var int */ const CREATE_NEW = 1, RECENTLY_VIEWED = 2, DASHBOARD = 3, ADD = 4, LANGSWITCH = 5, EVENT = 6, FULLTEXT_SEARCH = 7;
    – HeneryH
    Nov 26 '20 at 2:20
  • Sort of. You'd need to either hack civi or make your own module. But I've updated answer since you could also do this with civicrm_entity.
    – Demerit
    Nov 26 '20 at 14:39
  • I'll have to address this with the civi entity team but there is an install bug. composer - drupal/civicrm_entity 3.0.0-beta1 requires drupal/civicrm * -> no matching package found.
    – HeneryH
    Nov 26 '20 at 15:26
  • Did you see the note at github.com/eileenmcnaughton/civicrm_entity/tree/…
    – Demerit
    Nov 26 '20 at 15:41
  • 1
    Drupal Module civicrm_entity worked well. Thank you @Demerit. I had to git clone the repo since composer require didn't work but otherwise it works fine.
    – HeneryH
    Nov 26 '20 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.