You are here

function nodereferrer_field_settings in NodeReferrer 5

Same name and namespace in other branches
  1. 6 nodereferrer.module \nodereferrer_field_settings()

Implementation of hook_field_settings().

File

./nodereferrer.module, line 35
Defines a field type for backlinking referencing nodes. @todo -clear content cache with nodeapi. -query nids for access on load/view..

Code

function nodereferrer_field_settings($op, $field) {
  switch ($op) {
    case 'callbacks':
      return array(
        'view' => CONTENT_CALLBACK_CUSTOM,
      );
    case 'form':
      $form = array();
      $form['referrer_types'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Referring Node Types'),
        '#multiple' => TRUE,
        '#default_value' => isset($field['referrer_types']) ? $field['referrer_types'] : array(),
        '#options' => node_get_types('names'),
      );
      $options = nodereferrer_nodereference_field_options();
      $form['referrer_fields'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Referring Fields'),
        '#multiple' => TRUE,
        '#default_value' => isset($field['referrer_fields']) ? $field['referrer_fields'] : array(),
        '#options' => $options,
      );
      $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' => isset($field['referrer_nodes_per_page']) ? $field['referrer_nodes_per_page'] : 0,
      );
      $form['referrer_order'] = array(
        '#type' => 'select',
        '#title' => t('Refferer Sort Order'),
        '#options' => array(
          'CREATED_ASC' => t('Chronological Order'),
          'CREATED_DESC' => t('Reverse Chronological Order'),
          'TITLE_ASC' => t('Title Order'),
          'TITLE_DESC' => t('Reverse Title Order'),
        ),
        '#default_value' => isset($field['referrer_order']) ? $field['referrer_order'] : 'DESC',
      );
      return $form;
    case 'save':
      return array(
        'referrer_types',
        'referrer_fields',
        'referrer_nodes_per_page',
        'referrer_order',
      );
  }
}