Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
bryancasler CreditAttribution: bryancasler commentedsubscribe
Comment #2
amitaibuOr maybe I should use 'entity' => 'type' -- I need to experiment with it..
i.e.:
Comment #3
amitaibuEntity = type was the answer