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
    Commented Jun 3, 2021 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
    Commented Jun 3, 2021 at 8:09

1 Answer 1

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 and acknowledge you have read our privacy policy.

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