You are here

function simplenews_get_category_field in Simplenews 7

Get the fieldname(s) from a content type that hold the newsletter category term.

Parameters

$bundle_name: The content type of which to return the field.

Return value

field definition Field name of the field containing the newsletter category term. FALSE if no field is selected.

Related topics

2 calls to simplenews_get_category_field()
simplenews_get_term_values in ./simplenews.module
Get simplenews category term values from a node object.
simplenews_node_validate in ./simplenews.module
Implements hook_node_validate().

File

./simplenews.module, line 686
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_get_category_field($bundle_name) {
  $fields_info = field_info_fields();
  $field_name = variable_get('simplenews_category_field', 'field_simplenews_term');
  $instances = field_info_instances('node', $bundle_name);
  if (isset($instances[$field_name])) {
    return $fields_info[$field_name];
  }
  else {
    return FALSE;
  }
}