This feature request might turn into a support issue. An example OG group:
gid = 1
etid = 2
entity_type = node

This means group ID 1 is actually node ID 2. In most cases a group will be a node, but it can be any fieldable entity. (gid =2; etid = 10; entity_type= foo).

So I'de like to declare my metadata something like this:

  // Metadata info in the metadata class:
  $properties['node'] = array(
    'label' => t("Content"),
    'type' => 'node',
    'description' => t("The group associated with the group membership."),
    'required' => TRUE,
    'schema field' => 'etid',
    // Here is the dependency
    'dependency callbacks' => array(
      'og_is_node_callback',
    ),
  );

 /**
  *  Metadata dependency callback, that return true if the group belongs to a 
  *  node entity. 
  */
  function og_is_node_callback($group) {
    return $group->entity_type == 'node';
  }

So there will be e.g. tokens declared so one can do group:node:title -- but if the group is not a node, it will not explode ;)

Makes sense?

Makes sense?

Comments

bryancasler’s picture

subscribe

amitaibu’s picture

Or maybe I should use 'entity' => 'type' -- I need to experiment with it..

i.e.:

    $properties['etid'] += array(
      'required' => TRUE,
      'type' => 'entity',
    );
amitaibu’s picture

Category: feature » support
Status: Active » Closed (fixed)

Entity = type was the answer