1

This is referencing a Drupal 7 website with CiviCRM 5.36.x

When CiviCRM prints from a modal it invokes print.css which lives in /sites/all/modules/civicrm/css/. It does not invoke any other theme level css or the custom css that can be set in Administer/System Settings/Resource URLs.

In the case I'm working on, I have attached custom fieldsets to my membership types and applicants can apply via a webform to include a great deal of data.

If I view a membership from a contact record and print, the OEM print.css is invoked and the printed result or PDF is useless. To overcome this shortcoming, I've modified print.css but I'm looking for a long-term sustainable solution.

How does one override print.css with custom css?

Thanks.

2
  • Maybe not exactly what you're asking but if you turn off popups at Administer - Customize - Display Prefs then that would get around it?
    – Demerit
    Jun 3 at 0:32
  • Are your changes to print.css useful to others? How about creating a PR? Looks like that file has not had any attention for a long time.
    – Aidan
    Jun 3 at 8:09
1

I think you can use addStyle or addStyleUrl or addStyleFile methods

eg:

function extensionname_civicrm_config(&$config) {
  if (!empty($_REQUEST['snippet']) && $_REQUEST['snippet'] == 2) {
    Civi::resources()->addStyle('.label {     
      font-style: italic;
      font-weight: bold;
      font-size: 20px;
    }');
  }
}

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.