You are here

function _better_statistics_field_exists in Better Statistics 7

Helper function to determine whether a field is even declared by a module.

Parameters

$field: The name of the field to be checked.

Return value

TRUE if the field exists, FALSE otherwise.

2 calls to _better_statistics_field_exists()
drush_better_statistics_stats_dis in ./better_statistics.drush.inc
Drush command callback for stats-dis.
drush_better_statistics_stats_en in ./better_statistics.drush.inc
Drush command callback for stats-en.

File

./better_statistics.drush.inc, line 204
Drush integration of Better Statistics.

Code

function _better_statistics_field_exists($field) {
  static $declared_fields = array();

  // Load all fields by module.
  if (empty($declared_fields)) {
    module_load_include('inc', 'better_statistics', 'better_statistics.admin');
    $declared_fields = _better_statistics_get_custom_fields_by_module();
  }
  foreach ($declared_fields as $module => $fields) {
    if (array_key_exists($field, $fields)) {
      return TRUE;
    }
  }
  return FALSE;
}