When adding, editing, etc a page, there's a "page-node-edit" and "section-node-edit" class for the body tag. If you're viewing the same page, there's no corresponding class. How would I add something like "page-node-view"?

In my case, I want to stylize the H1 when viewing the page, but have the standard H1 style when editing the page. Right now I have to set the style for the node type and then undo all of it when there's a "page-node-edit". Seems there should be a cleaner way.

Comments

n8tron’s picture

Maybe something like this?

Place in template.php and replace sitetheme

function sitetheme_preprocess_html(&$variables, $hook) {
  $menu_item = menu_get_item();
  if ($menu_item['page_callback'] == 'node_page_view') {
    $variables['classes_array'][] = 'page-node-view'; 
  }
}
johnalbin’s picture

Component: CSS/HTML markup » layout.css
Status: Active » Closed (fixed)