function _anonymous_publishing_node_form in Anonymous Publishing 5
Helper function to make node form alterations to add the anonymous publishing feature.
Parameters
$form: The form definition.
$node: The node object.
1 call to _anonymous_publishing_node_form()
- anonymous_publishing_form_alter in ./
anonymous_publishing.module - Implementation of hook_form_alter().
File
- ./
anonymous_publishing.module, line 45 - Installation file for the anonymous_publishing module.
Code
function _anonymous_publishing_node_form(&$form, $node) {
global $user;
$form['anonymous_publishing'] = array(
'#type' => 'fieldset',
'#title' => t('Anonymous publishing'),
'#collapsible' => TRUE,
'#tree' => TRUE,
);
if ($user->uid) {
$form['anonymous_publishing']['options'] = array(
'#type' => 'radios',
'#options' => array(
t('Publish as %name', array(
'%name' => $user->name,
)),
t('Publish as Anonymous'),
),
);
}
elseif (!$node->nid) {
$form['anonymous_publishing']['email'] = array(
'#type' => 'textfield',
'#title' => t('Verification email'),
'#maxlength' => EMAIL_MAX_LENGTH,
'#description' => t('A verification email will be sent to this address. Your email address will NOT be shared with others.'),
'#required' => TRUE,
);
}
if (!count(element_children($form['anonymous_publishing']))) {
unset($form['anonymous_publishing']);
}
}