function nodereferrer_field_settings_form in NodeReferrer 7
Implements hook_field_settings_form().
File
- ./
nodereferrer.module, line 54 - Defines a field type for backlinking referencing nodes.
Code
function nodereferrer_field_settings_form($field, $instance, $has_data) {
$settings = $field['settings'];
$form = array();
// Hide unused options
$form['required'] = array(
'#type' => 'hidden',
'#value' => FALSE,
);
$form['multiple'] = array(
'#type' => 'hidden',
'#value' => 0,
);
$form['referrer_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Referring Node Types'),
'#multiple' => TRUE,
'#default_value' => $settings['referrer_types'],
'#options' => node_type_get_names(),
);
$options = _nodereferrer_nodereference_field_options();
$form['referrer_fields'] = array(
'#type' => 'checkboxes',
'#title' => t('Referring Fields'),
'#multiple' => TRUE,
'#default_value' => $settings['referrer_fields'],
'#options' => $options,
);
if (module_exists('translation')) {
$form['referrer_translations'] = array(
'#type' => 'checkbox',
'#title' => t('Show on translations'),
'#description' => t('If this is checked, referrers will also show on translations of the referenced node'),
'#default_value' => $settings['referrer_translations'],
);
}
$form['referrer_nodes_per_page'] = array(
'#type' => 'textfield',
'#title' => t('Referrers Per Page'),
'#description' => t('Referring nodes to display per page. 0 for no paging.'),
'#default_value' => $settings['referrer_nodes_per_page'],
);
$form['referrer_pager_element'] = array(
'#type' => 'textfield',
'#title' => t('Pager element'),
'#description' => t('Use this to avoid clashes if you have several pagers on one page'),
'#default_value' => $settings['referrer_pager_element'],
);
$options = array(
'CREATED_ASC' => t('Chronological Order'),
'CREATED_DESC' => t('Reverse Chronological Order'),
'TITLE_ASC' => t('Title Order'),
'TITLE_DESC' => t('Reverse Title Order'),
);
$form['referrer_order'] = array(
'#type' => 'select',
'#title' => t('Refferer Sort Order'),
'#options' => $options,
'#default_value' => $settings['referrer_order'],
);
return $form;
}