You are here

function hook_og_fields_info in Organic groups 7.2

Same name and namespace in other branches
  1. 7 og.api.php \hook_og_fields_info()

Provide information about fields that are related to Organic groups.

Using this info, Organic groups is aware of the fields, and allows adding them to the correct bundle.

  • type: Array with the values "group" and/ or "group content". To define to which bundles the field may be attached.
  • Description: The description of the field.
  • field: The field info array as will be passed to field_create_field().
  • instance: The field instance array as will be passed to field_info_instance().
  • entity type: Optional; Array of the entity types this field can be attached to. The field will not be attachable to other entity types. Defaults to empty array.
3 functions implement hook_og_fields_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

og_access_og_fields_info in og_access/og_access.module
Implement hook_og_fields_info().
og_og_fields_info in ./og.module
Implements hook_og_fields_info().
og_register_og_fields_info in og_register/og_register.module
Implements og_fields_info().
1 invocation of hook_og_fields_info()
og_fields_info in ./og.module
Get all the modules fields that can be assigned to fieldable entities.

File

./og.api.php, line 178
Hooks provided by the Organic groups module.

Code

function hook_og_fields_info() {
  $items = array();
  $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 type',
          1 => 'Group type',
        ),
        'allowed_values_function' => '',
      ),
    ),
    'instance' => array(
      'label' => t('Group type'),
      'widget_type' => 'options_select',
      'required' => TRUE,
      // Make the group type default.
      '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,
        ),
      ),
    ),
  );
  return $items;
}