You are here

function og_og_fields_info in Organic groups 7

Same name and namespace in other branches
  1. 7.2 og.module \og_og_fields_info()

Implements hook_og_fields_info().

File

./og.module, line 721
Enable users to create and manage groups with roles and permissions.

Code

function og_og_fields_info() {
  $items[OG_GROUP_FIELD] = array(
    'type' => array(
      'group',
    ),
    'description' => t('Determine if this should be a group.'),
    'field' => array(
      'field_name' => OG_GROUP_FIELD,
      'no_ui' => TRUE,
      'type' => 'list_boolean',
      'cardinality' => 1,
      'settings' => array(
        'allowed_values' => array(
          0 => 'Not a group',
          1 => 'Group',
        ),
        'allowed_values_function' => '',
      ),
    ),
    'instance' => array(
      'label' => t('Group'),
      'description' => t('Determine if this is an OG group.'),
      'display_label' => 1,
      'widget' => array(
        'module' => 'options',
        'settings' => array(),
        'type' => 'options_onoff',
        'weight' => 0,
      ),
      'default_value' => array(
        0 => array(
          'value' => 1,
        ),
      ),
      'view modes' => array(
        'full' => array(
          'label' => t('Full'),
          'type' => 'og_group_subscribe',
          'custom settings' => FALSE,
        ),
        'teaser' => array(
          'label' => t('Teaser'),
          'type' => 'og_group_subscribe',
          'custom settings' => FALSE,
        ),
      ),
    ),
  );
  $items[OG_DEFAULT_ACCESS_FIELD] = array(
    'type' => array(
      'group',
    ),
    'description' => t('Determine if group should use default roles and permissions.'),
    'field' => array(
      'field_name' => OG_DEFAULT_ACCESS_FIELD,
      'no_ui' => TRUE,
      'type' => 'list_boolean',
      'cardinality' => 1,
      'settings' => array(
        'allowed_values' => array(
          0 => 'Use default roles and permissions',
          1 => 'Override default roles and permissions',
        ),
        'allowed_values_function' => '',
      ),
    ),
    'instance' => array(
      'label' => t('Group roles and permissions'),
      'widget_type' => 'options_select',
      'required' => TRUE,
      // Use default role and permissions as default value.
      'default_value' => array(
        0 => array(
          'value' => 0,
        ),
      ),
      'view modes' => array(
        'full' => array(
          'label' => t('Full'),
          'type' => 'list_default',
          'custom settings' => FALSE,
        ),
        'teaser' => array(
          'label' => t('Teaser'),
          'type' => 'list_default',
          'custom settings' => FALSE,
        ),
      ),
    ),
  );
  $items[OG_AUDIENCE_FIELD] = array(
    'type' => array(
      'group content',
    ),
    'description' => t('Determine to which groups this group content is assigned to.'),
    'field' => array(
      'field_name' => OG_AUDIENCE_FIELD,
      'no_ui' => TRUE,
      'type' => 'group',
      'cardinality' => FIELD_CARDINALITY_UNLIMITED,
    ),
    'instance' => array(
      'label' => t('Groups audience'),
      'widget_type' => OG_AUDIENCE_FIELD,
      'default_value_function' => 'og_field_audience_default_value',
      'view modes' => array(
        'full' => array(
          'label' => t('Full'),
          'type' => 'og_list_default',
          'custom settings' => FALSE,
        ),
        'teaser' => array(
          'label' => t('Teaser'),
          'type' => 'og_list_default',
          'custom settings' => FALSE,
        ),
      ),
    ),
  );
  return $items;
}