You are here

function _pmpermission_get_field_name in Drupal PM (Project Management) 7.2

A helper function to check if a field is present in a node.

Parameters

string $bundle_name: Node bundle machine name.

string $category: Category of permission {pm, assigned, parent}.

Return value

string The actual name of the field if present, false otherwise.

4 calls to _pmpermission_get_field_name()
pmpermission_get_parent_nid_of_node in pmpermission/pmpermission.module
Recursively hunts and find out the first parent node of given type.
pmpermission_grants_list in pmpermission/pmpermission.module
Helper function for pmpermission_node_grants.
pmpermission_node_access_records in pmpermission/pmpermission.module
Implements hook_node_access_records().
pmpermission_permission_per_bundle in pmpermission/pmpermission.module
Creates an array of permission name for the given node bundle.

File

pmpermission/pmpermission.module, line 372
Main module file for the pmpermission module.

Code

function _pmpermission_get_field_name($bundle_name, $category) {
  switch ($category) {
    case 'parent':
      $field_name = variable_get("pmpermission_field_parent_reference_for_{$bundle_name}", FALSE);
      break;
    case 'assigned':
      $field_name = variable_get("pmpermission_field_assigned_reference", FALSE);
      break;
    case 'pm':
      $field_name = variable_get("pmpermission_field_pm_reference", FALSE);
      break;
    default:
      $field_name = FALSE;
      break;
  }
  if ($field_name and field_info_instance('node', $field_name, $bundle_name)) {
    return $field_name;
  }
  return FALSE;
}