You are here

public function OgMembershipMetadataController::entityPropertyInfo in Organic groups 7

Same name and namespace in other branches
  1. 7.2 og.info.inc \OgMembershipMetadataController::entityPropertyInfo()

Overrides EntityDefaultMetadataController::entityPropertyInfo

File

includes/og.info.inc, line 77
Provides Entity metadata integration.

Class

OgMembershipMetadataController
Extend the defaults.

Code

public function entityPropertyInfo() {
  $info = parent::entityPropertyInfo();
  $properties =& $info[$this->type]['properties'];

  // Initialize values
  $properties = !empty($properties) ? $properties : array();
  $properties += array(
    'entity_type' => array(),
  );

  // Group ID is provided in the "group" property.
  unset($properties['gid']);
  $properties['group'] = array(
    'label' => t("OG group"),
    'type' => 'group',
    'description' => t("The OG group associated with the OG membership."),
    'required' => TRUE,
    'getter callback' => 'entity_property_getter_method',
    'schema field' => 'gid',
  );

  // Entity id is provided via the "entity" property.
  unset($properties['etid']);
  $properties['entity'] = array(
    'label' => t('Entity'),
    'type' => 'entity',
    'description' => t('The entity that is a group content.'),
    'getter callback' => 'og_entity_getter',
    'setter callback' => 'og_entity_setter',
    'setter permission' => 'administer group',
    'required' => TRUE,
  );
  $properties['created']['type'] = 'date';
  $properties['created'] += array(
    'setter callback' => 'entity_property_verbatim_set',
  );
  $properties['state']['type'] = 'integer';
  $properties['state'] += array(
    'setter callback' => 'entity_property_verbatim_set',
    'options list' => 'og_group_content_states',
    'required' => TRUE,
  );
  $properties['entity_type'] += array(
    'setter callback' => 'entity_property_verbatim_set',
  );
  $properties['type']['type'] = 'og_membership_type';
  $properties['type'] += array(
    'required' => TRUE,
    'setter callback' => 'entity_property_verbatim_set',
  );
  return $info;
}