function _subscriptions_content_form_subscriptions_settings_form_alter in Subscriptions 7
Same name and namespace in other branches
- 2.0.x subscriptions_content/subscriptions_content.admin.inc \_subscriptions_content_form_subscriptions_settings_form_alter()
Implements hook_form_alter().
Add the Content Settings part to admin/settings/subscriptions.
_state
Parameters
array $form:
1 call to _subscriptions_content_form_subscriptions_settings_form_alter()
File
- ./
subscriptions_content.admin.inc, line 20 - Subscriptions Content module (admin functions).
Code
function _subscriptions_content_form_subscriptions_settings_form_alter(array &$form, array &$form_state) {
$tr = 't';
// General content settings
$select = array();
$select[0] = '<' . t('none') . '>';
$nodetypes = node_type_get_types();
foreach ($nodetypes as $ntype => $nname) {
$select[$ntype] = $nname->name;
}
$form['content'] = array(
'#type' => 'fieldset',
'#title' => t('Content settings'),
'#collapsible' => TRUE,
'#weight' => -10,
);
$form['content']['subscriptions_unlisted_content_types'] = array(
'#type' => 'select',
'#title' => t('Unlisted content types'),
'#default_value' => variable_get('subscriptions_unlisted_content_types', array()),
'#options' => $select,
'#description' => t('Select the content types which should be <strong>removed from subscriptions listings</strong>.<br />The content may still be available for subscribing via different kinds of subscriptions, but subscribing by content type will be unavailable for the selected types.'),
'#multiple' => TRUE,
);
$form['content']['subscriptions_blocked_content_types'] = array(
'#type' => 'select',
'#title' => t('Blocked content types'),
'#default_value' => variable_get('subscriptions_blocked_content_types', array()),
'#options' => $select,
'#description' => t('Select the content types which should be <strong>completely unavailable for subscribing</strong>, i.e. content of the selected types will never trigger notifications for regular users.'),
'#multiple' => TRUE,
);
$form['content']['subscriptions_blocked_content_types_note'] = array(
'#type' => 'item',
'#title' => t('Note'),
'#markup' => t("The %permission permission grants normal access to unlisted and blocked content types; this is intended as an administrative function, and the content types and links will be marked with a '!symbol' symbol (and appear !red_ON like this !red_OFF in the case of blocked types).", array(
'%permission' => t('subscribe to all content types'),
'!symbol' => SUBSCRIPTIONS_UNAVAILABLE,
'!red_ON' => '<span class="error">',
'!red_OFF' => '</span>',
)),
);
$form['content']['subscriptions_blocked_nodes'] = array(
'#type' => 'textfield',
'#title' => t('Blocked nodes'),
'#size' => 100,
'#maxlength' => 1000,
'#default_value' => variable_get('subscriptions_blocked_nodes', ''),
'#description' => t('Enter the IDs of nodes that should be <strong>completely unavailable for subscribing</strong>, separated by spaces.'),
);
$form['#validate'][] = '_subscriptions_content_validate_blocked_nodes';
$statics = variable_get('subscriptions_static_content_types', array());
$avoid_empty_subscribe_links = variable_get('subscriptions_avoid_empty_subscribe_links', 0);
$form['content']['static_content'] = array(
'#type' => 'fieldset',
'#title' => t('Static content'),
'#collapsible' => TRUE,
'#collapsed' => (empty($statics) || count($statics) == 1 && isset($statics[0])) && !$avoid_empty_subscribe_links,
);
$form['content']['static_content']['subscriptions_static_content_types'] = array(
'#type' => 'select',
'#title' => t('Static content types'),
'#default_value' => $statics,
'#options' => $select,
'#description' => t('Select the content types which do not change nor receive comments and thus should not have the %option option.', array(
'%option' => t('Subscribe to this page'),
)),
'#multiple' => TRUE,
);
$form['content']['static_content']['subscriptions_avoid_empty_subscribe_links'] = array(
'#type' => 'checkbox',
'#title' => t('Avoid empty %Subscribe links', array(
'%Subscribe' => t('Subscribe'),
)),
'#default_value' => $avoid_empty_subscribe_links,
'#description' => t('Nodes of %Static_content_types may end up with no %Subscribe options at all. Turn this option on to avoid displaying %Subscribe links in this case. The default is OFF, because this option causes processing overhead for each node view operation.', array(
'%Static_content_types' => t('Static content types'),
'%Subscribe' => t('Subscribe'),
)),
);
}