function internal_nodes_add_action in Internal Nodes 7
Adds the action and redirect fields.
Used by node type edit and node edit forms.
2 calls to internal_nodes_add_action()
- internal_nodes_form_node_form_alter in ./
internal_nodes.module - Implements hook_form_FORM_ID_alter() for the node form.
- internal_nodes_form_node_type_form_alter in ./
internal_nodes.module - Implements hook_form_FORM_ID_alter() for the node type form.
File
- ./
internal_nodes.module, line 273 - Internal nodes
Code
function internal_nodes_add_action(&$form, &$form_state, $form_id, $options) {
$form['internal_nodes'] = array(
'#type' => 'fieldset',
'#title' => t('Internal Nodes settings'),
'#access' => user_access('administer internal nodes'),
'#weight' => 50,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'additional_settings',
'#attached' => array(
'js' => array(
'internal-nodes' => drupal_get_path('module', 'internal_nodes') . '/internal_nodes.js',
),
),
);
$form['internal_nodes']['internal_nodes_action'] = array(
'#type' => 'radios',
'#title' => t('View action'),
'#description' => t('The action to take when node is view is attempted. <em>Allow</em> is default functionality.'),
'#default_value' => $options['action'],
'#options' => internal_nodes_get_actions(),
);
$form['internal_nodes']['internal_nodes_url'] = array(
'#type' => 'textfield',
'#title' => t('301 - Redirect destination'),
'#description' => t('The destination path or url when node view is specifically 301 denied. [token] notation, and GET (?), and anchor (#) are allowed.'),
'#default_value' => $options['url'],
);
// Display the list of available placeholders if token module is installed.
if (module_exists('token')) {
$form['internal_nodes']['token_help'] = array(
'#theme' => 'token_tree',
'#token_types' => array(
'node',
),
);
}
}