Unverified Commit f0139ced authored by alesr's avatar alesr Committed by GitHub

Merge pull request #383 from Gizra/2575833

OG entityreference field breaks Views when the field is attached to multiple entity types
parents 5ea3ea02 188ef952
......@@ -203,26 +203,20 @@ class OgBehaviorHandler extends EntityReference_BehaviorHandler_Abstract {
// that this field is attached to.
foreach ($entity_types as $entity_type) {
$entity_info = entity_get_info($entity_type);
$data['og_membership'] = array(
'table' => array(
'join' => array(
$entity_info['base table'] => array(
// Join entity base table on its id field with left_field.
'left_field' => $entity_info['entity keys']['id'],
'field' => 'etid',
'extra' => array(
0 => array(
'field' => 'entity_type',
'value' => $entity_type,
),
),
),
$data['og_membership']['table']['join'][$entity_info['base table']] = array(
// Join entity base table on its id field with left_field.
'left_field' => $entity_info['entity keys']['id'],
'field' => 'etid',
'extra' => array(
0 => array(
'field' => 'entity_type',
'value' => $entity_type,
),
),
// Copy the original config from the table definition.
$field['field_name'] => $data['field_data_' . $field['field_name']][$field['field_name']],
$field['field_name'] . '_target_id' => $data['field_data_' . $field['field_name']][$field['field_name'] . '_target_id'],
);
// Copy the original config from the table definition.
$data['og_membership'][$field['field_name']] = $data['field_data_' . $field['field_name']][$field['field_name']];
$data['og_membership'][$field['field_name'] . '_target_id'] = $data['field_data_' . $field['field_name']][$field['field_name'] . '_target_id'];
// Change config with settings from og_membership table.
foreach (array('filter', 'argument', 'sort', 'relationship') as $op) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment