You are here

function cpn_after_build in Code per Node 6

"#after_build" function which adds syntax highlighting. See http://drupal.org/node/322290.

1 string reference to 'cpn_after_build'
cpn_form_alter in ./cpn.module
Implemenation of hook_form_alter().

File

./cpn.module, line 195
Primary hook implementations.

Code

function cpn_after_build($form_element, &$form_state) {
  if (variable_get('cpn_syntax_highlighting', 0) === 'codemirror' && ($path = cpn_codemirror())) {
    drupal_add_js($path . '/lib/codemirror.js');
    drupal_add_css($path . '/lib/codemirror.css');
    if (isset($form_element['cpn']['css'])) {
      drupal_add_js($path . '/mode/css/css.js');
    }
    if (isset($form_element['cpn']['js'])) {
      drupal_add_js($path . '/mode/javascript/javascript.js');
    }
    drupal_add_css($path . '/theme/default.css');
    drupal_add_js(drupal_get_path('module', 'cpn') . '/cpn.js');
    drupal_add_css(drupal_get_path('module', 'cpn') . '/cpn.css');
  }
  return $form_element;
}