function subscriptions_content_form_alter in Subscriptions 7
Same name and namespace in other branches
- 5.2 subscriptions_content.module \subscriptions_content_form_alter()
- 6 subscriptions_content.module \subscriptions_content_form_alter()
- 2.0.x subscriptions_content/subscriptions_content.module \subscriptions_content_form_alter()
Implements hook_form_alter().
Adds the Send Subscriptions Notifications checkbox to the Publishing Options fieldset on the node edit form.
_state
Parameters
array $form:
string $form_id:
File
- ./
subscriptions_content.module, line 501 - Subscriptions to content events
Code
function subscriptions_content_form_alter(array &$form, array &$form_state, $form_id) {
if (isset($form['type']['#value']) && $form['type']['#value'] . '_node_form' == $form_id) {
if (isset($form['options'])) {
$tr = 't';
$form['options']['subscriptions_notify'] = array(
'#weight' => 50,
);
$form['options']['subscriptions_notify']['subscriptions_notify'] = array(
'#type' => 'checkbox',
'#title' => t('Send subscriptions notifications'),
'#default_value' => isset($form['#node']->subscriptions_notify) ? $form['#node']->subscriptions_notify : TRUE,
'#attributes' => array(
'class' => array(
'subscriptions-notifications',
),
),
);
$form['options']['subscriptions_notify']['note'] = array(
'#type' => 'item',
'#description' => t('You may want to turn %Send_subscriptions_notifications OFF when you only change %Publishing_options, otherwise Subscriptions will send out "update" notifications — this option is not saved.<br />Subscriptions does not send notifications for unpublished nodes (except to users who have the %administer_nodes permission), but when you set %Published to ON, Subscriptions will send out "new" notifications, unless you turn this off here.', array(
'%Send_subscriptions_notifications' => t('Send subscriptions notifications'),
'%Publishing_options' => $tr('Publishing options'),
'%administer_nodes' => $tr('Administer content'),
'%Published' => $tr('Published'),
)),
);
}
}
}