function ctools_process

Implements hook_process().

Add and remove CSS classes from the variables array. We use process so that we alter anything added in the preprocess hooks.

File

./ctools.module, line 855

Code

function ctools_process(&$variables, $hook) {
    if (!isset($variables['classes'])) {
        return;
    }
    $classes = ctools_get_classes();
    // Process the classses to add.
    if (!empty($classes[$hook]['add'])) {
        $add_classes = array_map('drupal_clean_css_identifier', $classes[$hook]['add']);
        $variables['classes_array'] = array_unique(array_merge($variables['classes_array'], $add_classes));
    }
    // Process the classes to remove.
    if (!empty($classes[$hook]['remove'])) {
        $remove_classes = array_map('drupal_clean_css_identifier', $classes[$hook]['remove']);
        $variables['classes_array'] = array_diff($variables['classes_array'], $remove_classes);
    }
    // Since this runs after template_process(), we need to re-implode the
    // classes array.
    $variables['classes'] = implode(' ', $variables['classes_array']);
}