You are here

function userreference_field_settings in Content Construction Kit (CCK) 5

Same name and namespace in other branches
  1. 6.3 modules/userreference/userreference.module \userreference_field_settings()
  2. 6 modules/userreference/userreference.module \userreference_field_settings()
  3. 6.2 modules/userreference/userreference.module \userreference_field_settings()

Implementation of hook_field_settings().

File

./userreference.module, line 34
Defines a field type for referencing a user from a node.

Code

function userreference_field_settings($op, $field) {
  switch ($op) {
    case 'form':
      $form = array();
      $form['referenceable_roles'] = array(
        '#type' => 'checkboxes',
        '#title' => t('User roles that can be referenced'),
        '#default_value' => isset($field['referenceable_roles']) ? $field['referenceable_roles'] : array(),
        '#options' => user_roles(1),
      );
      $form['referenceable_status'] = array(
        '#type' => 'checkboxes',
        '#title' => t('User status that can be referenced'),
        '#default_value' => is_array($field['referenceable_status']) ? array_filter($field['referenceable_status']) : array(
          1,
        ),
        '#options' => array(
          1 => t('Active'),
          0 => t('Blocked'),
        ),
      );
      return $form;
    case 'save':
      return array(
        'referenceable_roles',
        'referenceable_status',
      );
    case 'database columns':
      $columns = array(
        'uid' => array(
          'type' => 'int',
          'not null' => FALSE,
          'default' => NULL,
        ),
      );
      return $columns;
    case 'filters':
      return array(
        'default' => array(
          'list' => '_userreference_filter_handler',
          'list-type' => 'list',
          'operator' => 'views_handler_operator_or',
          'value-type' => 'array',
          'extra' => array(
            'field' => $field,
          ),
        ),
      );
  }
}