You are here

function multiple_email_views_data_alter in Multiple E-mail Addresses 2.x

Same name and namespace in other branches
  1. 6 views/multiple_email.views.inc \multiple_email_views_data_alter()
  2. 7 views/multiple_email.views.inc \multiple_email_views_data_alter()

@todo Please document this function.

See also

http://drupal.org/node/1354

File

views/multiple_email.views.inc, line 28
Contains Views integration for the multiple_email module.

Code

function multiple_email_views_data_alter(&$views_data) {
  foreach ($views_data as $table_key => $table) {
    foreach ($table as $key => $data) {
      if ($key != 'table' && $key != 'delta' && isset($data['field']['content_field_name'])) {
        if ($field = content_fields($data['field']['content_field_name'])) {
          if ($field['type'] == 'email') {
            $views_data[$table_key][$data['field']['content_field_name'] . '_match'] = array(
              'title' => $data['title short'] . ' (' . $field['field_name'] . ') - ' . t('match'),
              'help' => t("Match current user's multiple e-mail addresses to CCK E-mail field."),
              'group' => t('Content'),
              'filter' => $data['filter'],
            );
            $views_data[$table_key][$field['field_name'] . '_match']['filter']['handler'] = 'multiple_email_handler_filter_current';
          }
        }
      }
    }
  }
}