| @@ 878-898 (lines=21) @@ | ||
| 875 | /** |
|
| 876 | * Returns an array of entity types that are enabled via Commons Groups. |
|
| 877 | */ |
|
| 878 | function commons_groups_get_group_content_entity_types($cache = TRUE) { |
|
| 879 | // Find all Commons Entity integrations. |
|
| 880 | $commons_entity_integrations = commons_entity_integration_info(NULL, $cache); |
|
| 881 | if (empty($commons_entity_integrations)) { |
|
| 882 | return array(); |
|
| 883 | } |
|
| 884 | ||
| 885 | foreach ($commons_entity_integrations as $entity_type => $integration) { |
|
| 886 | foreach ($integration as $bundle => $options) { |
|
| 887 | if (isset($options['is_group_content']) && $options['is_group_content'] == FALSE) { |
|
| 888 | unset($commons_entity_integrations[$entity_type][$bundle]); |
|
| 889 | } |
|
| 890 | } |
|
| 891 | // If an entity type has no integrations, don't return it. |
|
| 892 | if (empty($commons_entity_integrations[$entity_type])) { |
|
| 893 | unset($commons_entity_integrations[$entity_type]); |
|
| 894 | } |
|
| 895 | } |
|
| 896 | ||
| 897 | return $commons_entity_integrations; |
|
| 898 | } |
|
| 899 | ||
| 900 | /** |
|
| 901 | * Returns an array of entity types that are defined as a group. |
|
| @@ 65-87 (lines=23) @@ | ||
| 62 | /** |
|
| 63 | * Returns an array of entity types that are enabled via Commons Radioactivity. |
|
| 64 | */ |
|
| 65 | function commons_radioactivity_get_radioactive_entity_types() { |
|
| 66 | // Find all Commons Entity integrations. |
|
| 67 | $commons_entity_integrations = commons_entity_integration_info(); |
|
| 68 | ||
| 69 | if (empty($commons_entity_integrations)) { |
|
| 70 | return array(); |
|
| 71 | } |
|
| 72 | ||
| 73 | foreach ($commons_entity_integrations as $entity_type => $integration) { |
|
| 74 | foreach ($integration as $bundle => $options) { |
|
| 75 | if (isset($options['radioactivity_exclude']) && $options['radioactivity_exclude'] == TRUE) { |
|
| 76 | unset($commons_entity_integrations[$entity_type][$bundle]); |
|
| 77 | } |
|
| 78 | } |
|
| 79 | ||
| 80 | // If an entity type has no integrations, don't return it. |
|
| 81 | if (empty($commons_entity_integrations[$entity_type])) { |
|
| 82 | unset($commons_entity_integrations[$entity_type]); |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| 86 | return $commons_entity_integrations; |
|
| 87 | } |
|
| 88 | ||
| 89 | /** |
|
| 90 | * Helper function to create Radioactivity incidents for nodes. |
|
| @@ 52-72 (lines=21) @@ | ||
| 49 | /** |
|
| 50 | * Returns an array of entity types that are enabled via Commons. |
|
| 51 | */ |
|
| 52 | function commons_topics_get_entity_types_with_topics() { |
|
| 53 | // Find all Commons Entity integrations. |
|
| 54 | $commons_entity_integrations = commons_entity_integration_info(); |
|
| 55 | if (empty($commons_entity_integrations)) { |
|
| 56 | return array(); |
|
| 57 | } |
|
| 58 | ||
| 59 | foreach ($commons_entity_integrations as $entity_type => $integration) { |
|
| 60 | foreach ($integration as $bundle => $options) { |
|
| 61 | if (isset($options['exclude_topics']) && $options['exclude_topics'] == TRUE) { |
|
| 62 | unset($commons_entity_integrations[$entity_type][$bundle]); |
|
| 63 | } |
|
| 64 | } |
|
| 65 | // If an entity type has no integrations, don't return it. |
|
| 66 | if (empty($commons_entity_integrations[$entity_type])) { |
|
| 67 | unset($commons_entity_integrations[$entity_type]); |
|
| 68 | } |
|
| 69 | } |
|
| 70 | ||
| 71 | return $commons_entity_integrations; |
|
| 72 | } |
|
| 73 | ||