function contentanalysis_form_alter in Content Analysis 6
Same name and namespace in other branches
- 8 contentanalysis.module \contentanalysis_form_alter()
- 7 contentanalysis.module \contentanalysis_form_alter()
Implementation of hook_form_alter().
Add Content Optimizer field set to node edit forms. Add Content Analysis enabled field to content type admin form
File
- ./
contentanalysis.module, line 1379
Code
function contentanalysis_form_alter(&$form, $form_state, $form_id) {
if (isset($form['type']['#value']) && $form['type']['#value'] . '_node_form' == $form_id && variable_get('contentanalysis_type_' . $form['#node']->type . '_enable', 1)) {
if (!user_access('perform content analysis')) {
return '';
}
$node = $form['#node'];
//$form['contentanalysis'] = contentanalysis_node_form($form_state, array(), $node, $settings);
$form['contentanalysis'] = array(
'#type' => 'fieldset',
'#title' => t('Content analysis'),
'#collapsible' => TRUE,
'#collapsed' => variable_get('contentanalysis_node_edit_form_collapsed', 0),
'#attributes' => array(
'class' => 'contentanalysis',
),
);
$form['contentanalysis'] = array_merge($form['contentanalysis'], contentanalysis_analysis_form($form_state, array(), $node, 'node-edit'));
$form['#submit'][] = 'contentanalysis_node_submit';
}
if ($form_id == 'node_type_form') {
$form['contentanalysis'] = array(
'#type' => 'fieldset',
'#title' => t('Content Analysis Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => TRUE,
);
$form['contentanalysis']['enable'] = array(
'#type' => 'checkboxes',
'#title' => t('Content Analysis'),
'#description' => t('If checked, the <em>Content Analysis</em> fieldset will appear on the node edit form for those who have permission to perform content analysis.'),
'#options' => array(
'enable' => t('Enable'),
),
'#default_value' => variable_get('contentanalysis_type_' . $form['#node_type']->type . '_enable', 1) ? array(
'enable',
) : array(),
);
$form['#submit'][] = 'contentanalysis_node_type_form_submit';
}
}