You are here

class OgMembershipMetadataController in Organic groups 7

Same name and namespace in other branches
  1. 7.2 og.info.inc \OgMembershipMetadataController

Extend the defaults.

Hierarchy

Expanded class hierarchy of OgMembershipMetadataController

1 string reference to 'OgMembershipMetadataController'
og_entity_info in ./og.module
Implements hook_entity_info().

File

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

View source
class OgMembershipMetadataController extends EntityDefaultMetadataController {
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityDefaultMetadataController::$type protected property
EntityDefaultMetadataController::bundleOptionsList public static function A options list callback returning all bundles for an entity type.
EntityDefaultMetadataController::convertSchema protected function Return a set of properties for an entity based on the schema definition
EntityDefaultMetadataController::__construct public function
OgMembershipMetadataController::entityPropertyInfo public function Overrides EntityDefaultMetadataController::entityPropertyInfo