function simplenews_issue_sent_count_field_add in Simplenews 7.2
Add field for status
Parameters
$type A node type object.:
Related topics
2 calls to simplenews_issue_sent_count_field_add()
- simplenews_issue_fields_add in ./
simplenews.module - Add fields for newsletter, status and sent count to a note type.
- simplenews_update_7200 in ./
simplenews.install - Replace {simplenews_newsletter}.
File
- ./
simplenews.module, line 749 - Simplenews node handling, sent email, newsletter block and general hooks
Code
function simplenews_issue_sent_count_field_add($type) {
$field_name = variable_get('simplenews_sent_count_field', 'simplenews_sent_count');
$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' => 'number_integer',
'cardinality' => 1,
'entity_types' => array(
'node',
),
'translatable' => FALSE,
'settings' => array(),
);
$field = field_create_field($field);
}
if (empty($instance)) {
$instance = array(
'label' => t('Sent subscriber count'),
'field_name' => $field_name,
'bundle' => $type->type,
'entity_type' => 'node',
'display' => array(
'default' => array(
'label' => 'hidden',
'type' => 'hidden',
),
'teaser' => array(
'label' => 'hidden',
'type' => 'hidden',
),
'email_plain' => array(
'label' => 'hidden',
'type' => 'hidden',
),
'email_html' => array(
'label' => 'hidden',
'type' => 'hidden',
),
'email_textalt' => array(
'label' => 'hidden',
'type' => 'hidden',
),
),
);
field_create_instance($instance);
}
}