You are here

function message_ui_views_default_views_alter in Message UI 7

Implements hook_views_default_views_alter().

File

views/message_ui.views.inc, line 38
integration with the views module.

Code

function message_ui_views_default_views_alter(&$views) {
  if (!in_array('message', array_keys($views))) {
    return;
  }
  $handler =& $views['message']->display['default']->handler;

  /* Field: Message: Edit message */
  $field['edit']['id'] = 'edit';
  $field['edit']['table'] = 'message';
  $field['edit']['field'] = 'edit';
  $field['edit']['label'] = '';
  $field['edit']['exclude'] = TRUE;
  $field['edit']['element_label_colon'] = FALSE;

  /* Field: Message: Delete message */
  $field['delete']['id'] = 'delete';
  $field['delete']['table'] = 'message';
  $field['delete']['field'] = 'delete';
  $field['delete']['label'] = '';
  $field['delete']['exclude'] = TRUE;
  $field['delete']['element_label_colon'] = FALSE;

  /* Field: Message: View message */
  $field['view']['id'] = 'view';
  $field['view']['table'] = 'message';
  $field['view']['field'] = 'view';
  $field['view']['label'] = '';
  $field['view']['exclude'] = TRUE;
  $field['view']['element_label_colon'] = FALSE;
  $handler->display->display_options['fields'] = $field + $handler->display->display_options['fields'];

  /* Field: Global: Custom text */
  $handler->display->display_options['fields']['nothing']['id'] = 'nothing';
  $handler->display->display_options['fields']['nothing']['table'] = 'views';
  $handler->display->display_options['fields']['nothing']['field'] = 'nothing';
  $handler->display->display_options['fields']['nothing']['label'] = 'Operation';
  $text = '[view] [edit] [delete] ';

  // In case this value was set previously by another "views_default_views_alter".
  if (isset($handler->display->display_options['fields']['nothing']['alter']['text'])) {
    $handler->display->display_options['fields']['nothing']['alter']['text'] .= $text;
  }
  else {
    $handler->display->display_options['fields']['nothing']['alter']['text'] = $text;
  }
}