You are here

function custom_pub_preprocess_node in Custom Publishing Options 7

Implements hook_preprocess_node(). Add the custom publishing option state as a class if it is enabled, similar to core node publish states.

Parameters

$variables:

File

./custom_pub.module, line 594
Adds the ability to add Custom publishing options to the node Add/Edit forms.

Code

function custom_pub_preprocess_node(&$variables) {
  $types = custom_pub_by_node_type($variables['type']);
  if (count($types)) {
    $ids = array_keys($types);
    $node = $variables['node'];
    foreach ($ids as $machine_name) {
      if (isset($node->{$machine_name}) && $node->{$machine_name}) {
        $variables['classes_array'][] = 'node-' . $machine_name;
      }
    }
  }
}