function simplenews_issue_handler_settings_field_add in Simplenews 7.2
Add a field for the recipient handler settings.
Parameters
$type A node type object:
Related topics
2 calls to simplenews_issue_handler_settings_field_add()
- simplenews_issue_fields_add in ./
simplenews.module - Add fields for newsletter, status and sent count to a note type.
- simplenews_update_7206 in ./
simplenews.install - Add recipient handler and handler settings field to issue content types.
File
- ./
simplenews.module, line 630 - Simplenews node handling, sent email, newsletter block and general hooks
Code
function simplenews_issue_handler_settings_field_add($type) {
$field_name = variable_get('simplenews_handler_settings_field', 'simplenews_handler_settings');
$field = field_info_field($field_name);
$instance = field_info_instance('node', $field_name, $type->type);
if (empty($field)) {
$field = array(
'field_name' => $field_name,
'type' => 'text_long',
'cardinality' => 1,
'entity_types' => array(
'node',
),
'translatable' => FALSE,
'settings' => array(),
'default_formatter' => 'hidden',
);
$field = field_create_field($field);
}
if (empty($instance)) {
// We set the default value to simplenews_subscription
$instance = array(
'label' => t('Recipient Handle Settings'),
'field_name' => $field_name,
'bundle' => $type->type,
'entity_type' => 'node',
'widget' => array(
'type' => 'text_textarea',
),
'display' => array(
'default' => array(
'label' => 'hidden',
'type' => 'hidden',
),
),
);
field_create_instance($instance);
}
}