function better_statistics_better_statistics_fields in Better Statistics 7
Implements hook_better_statistics_fields().
File
- ./
better_statistics.statistics.inc, line 12 - Statistics API functions and hooks for the Better Statistics module.
Code
function better_statistics_better_statistics_fields() {
$fields = array();
$path = drupal_get_path('module', 'better_statistics');
// Pass all user-facing strings through t(), but always use English when first
// declaring fields. They will be run through t() normally on output.
$en = array(
'langcode' => 'en',
);
// Declare a cache status field.
$fields['cache'] = array(
'schema' => array(
'type' => 'varchar',
'length' => 128,
'not null' => FALSE,
'description' => 'Cache hit, miss, or not applicable.',
),
'callback' => 'better_statistics_get_field_value',
'views_field' => array(
'title' => t('Cache status', array(), $en),
'help' => t('The cache status of the page (HIT, MISS, or NULL).', array(), $en),
),
'js' => array(
'data' => $path . '/js/fields/custom.js',
'type' => 'file',
),
);
// Declare a user agent field.
$fields['user_agent'] = array(
'schema' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'User-agent string used on the request.',
),
'callback' => 'better_statistics_get_field_value',
'views_field' => array(
'title' => t('User-agent', array(), $en),
'help' => t('User-agent string of the user who visited your page.', array(), $en),
),
'js' => array(
'data' => $path . '/js/fields/custom.js',
'type' => 'file',
),
);
// Declare a peak memory field.
$fields['peak_memory'] = array(
'schema' => array(
'type' => 'int',
'size' => 'normal',
'not null' => TRUE,
'default' => 0,
'unsigned' => TRUE,
'description' => 'Peak memory in bytes allocated for the request.',
),
'callback' => 'memory_get_peak_usage',
'views_field' => array(
'title' => t('Peak memory', array(), $en),
'help' => t('Size in bytes of the peak memory allocated for the request.', array(), $en),
),
'js' => array(
'data' => $path . '/js/fields/custom.js',
'type' => 'file',
),
);
return $fields;
}