function private_message_entity_extra_field_info in Private Message 8
Same name and namespace in other branches
- 8.2 private_message.module \private_message_entity_extra_field_info()
Implements hook_entity_extra_field_info().
File
- ./
private_message.module, line 22 - Contains hooks for the private message module.
Code
function private_message_entity_extra_field_info() {
$private_message_thread_bundles = \Drupal::entityManager()
->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']['delete_link'] = [
'label' => t('Delete link'),
'description' => t('The link to delete the thread'),
'weight' => -100,
'visible' => TRUE,
];
}
$private_message_bundles = \Drupal::entityManager()
->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::entityManager()
->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::entityManager()
->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::entityManager()
->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,
];
}
return $fields;
}