-
Notifications
You must be signed in to change notification settings - Fork 1
/
new_relic_insights.views.inc
42 lines (35 loc) · 1.45 KB
/
new_relic_insights.views.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* @file
* Views hooks for the New Relic Insights Entity module.
*/
/**
* Implements hook_views_data_alter().
*
* Updates core Insights property metadata for better UX in the Views UI.
*/
function new_relic_insights_views_data_alter(&$data) {
// Unset versions of the Insight entity that we do not want to be queryable.
unset($data['insight'], $data['entity_insight']);
// Rename the EntityFieldQuery label.
if (isset($data['efq_insight'])) {
$data['efq_insight']['table']['base']['title'] = t('Insights');
// Loop through custom properties provided by Better Stats and apply them.
if (module_exists('better_statistics')) {
$current = variable_get('better_statistics_fields', better_statistics_get_default_fields());
foreach($current as $field => $definition) {
if (isset($definition['views_field']['title'])) {
$data['efq_insight'][$field]['title'] = $definition['views_field']['title'];
}
if (isset($definition['views_field']['help'])) {
$data['efq_insight'][$field]['help'] = $definition['views_field']['help'];
}
}
}
// Loop through the default properties and provide better UI text.
foreach(new_relic_insights_entity_default_properties('Transaction') as $prop => $definition) {
$data['efq_insight'][$prop]['title'] = $definition['views_field']['title'];
$data['efq_insight'][$prop]['help'] = $definition['views_field']['help'];
}
}
}