function om_node in OM Tools 7
Same name and namespace in other branches
- 8 tools/node/node.inc \om_node()
- 6 tools/node/node.inc \om_node()
OM Tools Node Utility Settings
File
- tools/
node/ node.inc, line 11 - Body Classes Utility
Code
function om_node(&$form) {
drupal_add_js(drupal_get_path('module', 'om_tools') . '/tools/node/js/node.js', 'file');
// Reset Node Form
if (variable_get('om_tools_node_tools_reset', 0)) {
foreach (node_type_get_types() as $type => $info) {
variable_set('om_tools_node_' . $type . '_titles', 0);
}
variable_set('om_tools_node_body_classes', 1);
variable_set('om_tools_node_body_classes_prefix', 'content-type-');
variable_set('om_tools_node_terms_body_classes', 1);
variable_set('om_tools_node_terms_body_classes_prefix', 'content-term-');
variable_set('om_tools_node_tools_reset', 0);
}
// Node Form
$form['node_tools'] = array(
'#type' => 'fieldset',
'#title' => t('Node Tools'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t(''),
);
$form['node_tools']['node_tools_switch'] = array(
'#type' => 'checkbox',
'#title' => t('Apply node tools'),
'#default_value' => variable_get('om_tools_node_tools_switch', 1),
'#description' => t(''),
);
$form['node_tools']['node_settings'] = array(
'#type' => 'fieldset',
'#attributes' => array(
'id' => 'om-group-node-tools-settings',
),
'#title' => t('Body Classes Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t(''),
);
$form['node_tools']['node_settings']['node_body_classes'] = array(
'#type' => 'checkbox',
'#title' => t('Add node body classes'),
'#default_value' => variable_get('om_tools_node_body_classes', 1),
'#description' => t(''),
);
$form['node_tools']['node_settings']['node_body_classes_prefix'] = array(
'#type' => 'textfield',
'#title' => t('Node class prefix'),
'#default_value' => variable_get('om_tools_node_body_classes_prefix', 'content-type-'),
'#description' => t('content-type-page content-type-page-add | content-type-page-edit | content-type-page-view | content-type-page-delete section-node-add | section-node-edit | section-node-delete'),
);
$form['node_tools']['node_settings']['node_terms_body_classes'] = array(
'#type' => 'checkbox',
'#title' => t('Add node terms body classes'),
'#default_value' => variable_get('om_tools_node_terms_body_classes', 1),
'#description' => t(''),
);
$form['node_tools']['node_settings']['node_terms_body_classes_prefix'] = array(
'#type' => 'textfield',
'#title' => t('Term class prefix'),
'#default_value' => variable_get('om_tools_node_terms_body_classes_prefix', 'content-term-'),
'#description' => t('content-term-mobile content-term-technology content-term-educaton ...'),
);
$form['node_tools']['node_settings']['node_titles'] = array(
'#type' => 'fieldset',
'#title' => t('Node Titles'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('Hide all titles for each content type. If you are not using OM Base Theme add "body.om-tools-no-title h1.title { display: none; }" to your css.'),
);
foreach (node_type_get_types() as $type => $info) {
$form['node_tools']['node_settings']['node_titles']['node_' . $type . '_titles'] = array(
'#type' => 'checkbox',
'#title' => t('Hide ' . $type . ' titles'),
'#default_value' => variable_get('om_tools_node_' . $type . '_titles', 0),
'#description' => t(''),
);
}
$form['node_tools']['node_tools_reset'] = array(
'#type' => 'checkbox',
'#title' => t('Reset to default values.'),
'#default_value' => variable_get('om_tools_node_tools_reset', 0),
'#description' => t(''),
);
return $form;
}