You are here

function og_subgroups_og_fields_info in Subgroups for Organic groups 7.2

Implements hook_og_fields_info().

File

./og_subgroups.module, line 32
Provides users the ability to inherit permissions on subgroups.

Code

function og_subgroups_og_fields_info() {
  $allowed_values = array(
    0 => 'No - subgroups of this group won\'t inherit its users.',
    1 => 'Yes - subgroups of this group will inherit its users.',
  );
  $items[OG_USER_INHERITANCE_FIELD] = array(
    'type' => array(
      'group',
    ),
    'description' => t('Determine if the subgroups of a group will inherit its users.'),
    'entity' => array(
      'node',
    ),
    'field' => array(
      'field_name' => OG_USER_INHERITANCE_FIELD,
      'no_ui' => TRUE,
      'type' => 'list_boolean',
      'cardinality' => 1,
      'settings' => array(
        'allowed_values' => $allowed_values,
        'allowed_values_function' => '',
      ),
    ),
    'instance' => array(
      'label' => t('Group user inheritance'),
      'required' => TRUE,
      'default_value' => array(
        0 => array(
          'value' => 1,
        ),
      ),
      'widget_type' => 'options_select',
      'view modes' => array(
        'full' => array(
          'label' => 'above',
          'type' => 'options_onoff',
        ),
        'teaser' => array(
          'label' => 'above',
          'type' => 'options_onoff',
        ),
      ),
    ),
  );
  $items[OG_USER_INHERITANCE_PERMISSION_FIELD] = array(
    'type' => array(
      'group',
    ),
    'description' => t('Determines how permissions are given for inherited for inherited users.'),
    'entity' => array(
      'node',
    ),
    'field' => array(
      'field_name' => OG_USER_INHERITANCE_PERMISSION_FIELD,
      'no_ui' => TRUE,
      'type' => 'list_boolean',
      'cardinality' => 1,
      'settings' => array(
        'allowed_values' => array(),
        'allowed_values_function' => 'og_subgroups_og_user_inhertiance_permission_allowed_values',
      ),
    ),
    'instance' => array(
      'label' => t('Group user permission inheritance'),
      'required' => TRUE,
      'default_value' => array(
        0 => array(
          'value' => OG_USER_INHERITANCE_PERMISSION_INHERIT,
        ),
      ),
      'widget_type' => 'options_select',
      'view modes' => array(
        'full' => array(
          'label' => 'above',
          'type' => 'options_onoff',
        ),
        'teaser' => array(
          'label' => 'above',
          'type' => 'options_onoff',
        ),
      ),
    ),
  );
  return $items;
}