You are here

function better_statistics_get_default_fields in Better Statistics 7

Returns default fields in the exact same form expected of fields exposed via hook_better_statistics_fields().

14 calls to better_statistics_get_default_fields()
better_statistics_access_log in ./better_statistics.admin.inc
Displays details of recent page accesses.
better_statistics_better_statistics_log in ./better_statistics.statistics.inc
Implements hook_better_statistics_log().
better_statistics_disable_fields in ./better_statistics.admin.inc
Disables a list of statistics fields.
better_statistics_enable_fields in ./better_statistics.admin.inc
Enables a list of statistics fields.
better_statistics_get_fields_data in ./better_statistics.module
Returns data for all valid, declared fields in preparation for DB insertion.

... See full list

File

./better_statistics.module, line 299
Drupal hook implementations for the Better Statistics module.

Code

function better_statistics_get_default_fields() {
  static $default_fields;
  if (!isset($default_fields)) {

    // In some contexts, drupal_get_schema_unproccessed may be unavailable, so
    // here, we get the accesslog schema the same way it does.
    require_once DRUPAL_ROOT . '/modules/statistics/statistics.install';
    $schema = module_invoke('statistics', 'schema');

    // Expose Drupal Core's accesslog fields to our own API.
    $accesslog = $schema['accesslog'];
    foreach ($accesslog['fields'] as $field => $schema) {
      $default_fields[$field] = array(
        'schema' => $schema,
        'views_field' => FALSE,
        'callback' => 'better_statistics_get_field_value',
        'js' => array(
          'data' => dirname(drupal_get_filename('module', 'better_statistics')) . '/js/fields/core.js',
          'type' => 'file',
        ),
      );
    }
  }
  return $default_fields;
}