You are here

function pm_field_extra_fields in Drupal PM (Project Management) 8

Same name and namespace in other branches
  1. 7.3 pm.module \pm_field_extra_fields()

Implements hook_field_extra_fields().

File

./pm.module, line 149
Main module file for the Project Management module.

Code

function pm_field_extra_fields() {
  $default = array(
    'node:pmorganization' => 'node:pmorganization',
    'node:pmproject' => 'node:pmproject',
    'node:pmissue' => 'node:pmissue',
    'node:pmtask' => 'node:pmtask',
    'node:pmticket' => 'node:pmticket',
    'node:pmtimetracking' => 'node:pmtimetracking',
    'node:pmteam' => 'node:pmteam',
    'node:pmnote' => 'node:pmnote',
    'node:pmexpense' => 'node:pmexpense',
    'user:user' => 'user:user',
  );
  $enabled_content_types = variable_get('pm_contextual_links_enabled_content_types', $default);
  foreach ($enabled_content_types as $info) {
    if ($info) {
      $info = explode(':', $info);
      $entity_type = $info[0];
      $bundle = $info[1];
      $extra[$entity_type][$bundle]['display'][PM_CONTEXTUAL_LINK_PSEUDO_FIELD] = array(
        'label' => t('Drupal PM contextual links.'),
        'description' => t('Add a contextual link exposing various Drupal PM related tasks on Drupal Entities.'),
        'weight' => 50,
      );
    }
  }
  return $extra;
}