You are here

function private_message_entity_extra_field_info in Private Message 8.2

Same name and namespace in other branches
  1. 8 private_message.module \private_message_entity_extra_field_info()

Implements hook_entity_extra_field_info().

File

./private_message.module, line 20
Contains hooks for the private message module.

Code

function private_message_entity_extra_field_info() {
  $private_message_thread_bundles = \Drupal::service('entity_type.bundle.info')
    ->getBundleInfo('private_message_thread');
  foreach (array_keys($private_message_thread_bundles) as $bundle) {
    $fields['private_message_thread'][$bundle]['display']['last_message'] = [
      'label' => t('Last Message'),
      'description' => t('Displays the last message in the thread'),
      'weight' => 100,
      'visible' => TRUE,
    ];
    $fields['private_message_thread'][$bundle]['display']['private_message_form'] = [
      'label' => t('Form'),
      'description' => t('The form to create a new message'),
      'weight' => 100,
      'visible' => FALSE,
    ];
    $fields['private_message_thread'][$bundle]['display']['no_active_users'] = [
      'label' => t('No active users'),
      'description' => t('The notice that there are no active users'),
      'weight' => 100,
      'visible' => FALSE,
    ];
    $fields['private_message_thread'][$bundle]['display']['delete_link'] = [
      'label' => t('Delete link'),
      'description' => t('The link to delete the thread'),
      'weight' => -100,
      'visible' => TRUE,
    ];
  }
  $private_message_bundles = \Drupal::service('entity_type.bundle.info')
    ->getBundleInfo('private_message');
  foreach (array_keys($private_message_bundles) as $bundle) {
    $fields['private_message'][$bundle]['form']['members'] = [
      'label' => t('Members'),
      'description' => t('The widget to add members to the private message thread'),
      'weight' => -100,
      'visible' => TRUE,
    ];
  }
  $user_bundles = \Drupal::service('entity_type.bundle.info')
    ->getBundleInfo('user');
  foreach (array_keys($user_bundles) as $bundle) {
    $fields['user'][$bundle]['display']['linked_username'] = [
      'label' => t('Username (linked if viewer has permission)'),
      'description' => t('Displays the username, linked to the user profile if the viewer has permission to access user profiles'),
      'weight' => 0,
      'visible' => FALSE,
    ];
    $fields['user'][$bundle]['display']['private_message_link'] = [
      'label' => t('Private message thread link'),
      'description' => t('Displays a link to send a private message to the user'),
      'weight' => 0,
      'visible' => FALSE,
    ];
    $fields['user'][$bundle]['form']['private_messages'] = [
      'label' => t('Private messages'),
      'description' => t('Settings related to private messages'),
      'weight' => 0,
      'visible' => TRUE,
    ];
  }
  $node_bundles = \Drupal::service('entity_type.bundle.info')
    ->getBundleInfo('node');
  foreach (array_keys($node_bundles) as $bundle) {
    $fields['node'][$bundle]['display']['private_message_link'] = [
      'label' => t('Private message thread link'),
      'description' => t('Displays a link to send a private message to the node author'),
      'weight' => 0,
      'visible' => FALSE,
    ];
  }
  $node_bundles = \Drupal::service('entity_type.bundle.info')
    ->getBundleInfo('comment');
  foreach (array_keys($node_bundles) as $bundle) {
    $fields['comment'][$bundle]['display']['private_message_link'] = [
      'label' => t('Private message thread link'),
      'description' => t('Displays a link to send a private message to the node author'),
      'weight' => 0,
      'visible' => FALSE,
    ];
  }
  $profile_bundles = \Drupal::service('entity_type.bundle.info')
    ->getBundleInfo('profile');
  foreach (array_keys($profile_bundles) as $bundle) {
    $fields['profile'][$bundle]['display']['private_message_link'] = [
      'label' => t('Private message thread link'),
      'description' => t('Displays a link to send a private message to the profile owner'),
      'weight' => 0,
      'visible' => FALSE,
    ];
  }
  return $fields;
}