function nodereference_count_field_settings in Nodereference Count 6
Implementation of hook_field_settings().
File
- ./
nodereference_count.module, line 44 - Defines a field type for counting the references to a node.
Code
function nodereference_count_field_settings($op, $field) {
switch ($op) {
case 'form':
$options = nodereference_count_field_options($field);
$form = array();
$form['referenceable_fields'] = array(
'#type' => 'checkboxes',
'#title' => t('Nodereference fields that can be counted'),
'#description' => t('The nodereference fields that reference this content type.'),
'#multiple' => TRUE,
'#default_value' => is_array($field['referenceable_fields']) ? $field['referenceable_fields'] : array(),
'#options' => array_map('check_plain', $options),
);
if (empty($options)) {
$form['referenceable_fields_empty'] = array(
'#prefix' => '<p>',
'#value' => t('There are no nodereference fields to count. Add a node reference field to another content type, allowing it to reference this content type, if you wish to count the number of references to a node of this type.'),
'#suffix' => '</p>',
);
}
else {
$form['referenceable_fields_count_by_status'] = array(
'#type' => 'radios',
'#title' => t('Count by node status'),
'#multiple' => FALSE,
'#default_value' => !empty($field['referenceable_fields_count_by_status']) ? $field['referenceable_fields_count_by_status'] : '',
'#options' => array(
'all' => t('Count all nodes'),
'published' => t('Count published nodes'),
),
);
}
return $form;
case 'save':
return array(
'referenceable_fields',
'referenceable_fields_count_by_status',
);
case 'database columns':
return array(
'value' => array(
'type' => 'int',
'not null' => FALSE,
'sortable' => TRUE,
'views' => TRUE,
),
);
}
}