function siteimprove_form_alter in Siteimprove 7
Implements hook_form_alter().
File
- ./
siteimprove.module, line 49 - Drupal Module: Siteimprove Plugin.
Code
function siteimprove_form_alter(&$form, &$form_state, $form_id) {
// Check if the user has access.
if (user_access(SITEIMPROVE_PERMISSION_USE)) {
// In node and taxonomy term forms, add siteimprove js.
if (strpos($form_id, '_node_form') !== FALSE && isset($form_state['node']->nid) || $form_id == 'taxonomy_form_term' && isset($form_state['term']->tid)) {
// Only show recheck button for published nodes or any term.
if (strpos($form_id, '_node_form') !== FALSE && isset($form_state['node']->nid) && $form_state['node']->status != 0 || $form_id == 'taxonomy_form_term' && isset($form_state['term']->tid)) {
// Add recheck button.
$form['actions']['recheck'] = array(
'#attributes' => array(
'class' => array(
'recheck-button',
),
),
'#type' => 'button',
'#value' => t('Siteimprove Recheck'),
'#weight' => 7,
);
}
}
}
}