1

Does anybody have an idea, how and where we build CiviCRM class on body tag.? enter image description here E.g. 1

E.g. 2

Basically class build using civicrm url

  • page-civicrm-admin-setting-updateconfigbackend
  • page-civicrm-admin-setting
  • page-civicrm-admin
  • page-civicrm
1

Some of it is added via javascript, e.g. https://github.com/civicrm/civicrm-core/blob/5.15.2/js/crm.menubar.js#L104

But as this ticket notes the rest depends a bit on the CMS and the theme and is inconsistent: https://lab.civicrm.org/dev/core/issues/300

1

I was using Drupal 8 adminimal theme and shoreditch civicrm theme. but civicrm tab for contact were not showing correctly as expected. Found issue that civicrm class build using url path were not present.

Following block should be present in hook_preprocess_HOOK, This is total CMS functionality.

File Ref : adminimal_theme/adminimal_theme.theme

/**
 * Implements hook_preprocess_HOOK() for HTML document templates.
 */
function adminimal_theme_preprocess_html(&$variables) {
  // Add adminimal class to the body.
  $path_args = explode('/', \Drupal::request()->getPathInfo());
  $path_args = array_filter($path_args);
  if ($suggestions = theme_get_suggestions($path_args, 'page', '-')) {
    foreach ($suggestions as $suggestion) {
      $variables['attributes']['class'][] = $suggestion;
    }
  }
}

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.