You are here

function fasttoggle_fasttoggle_field_access in Fasttoggle 7

Whether to allow access to update the field.

Parameters

object $object: The object being considered.

string $type: The type of object.

string $group: The setting group.

string $fieldname: The name of the field being toggled.

Return value

mixed Tristate result.

1 string reference to 'fasttoggle_fasttoggle_field_access'
fasttoggle_field_merge_field_labels in module/fasttoggle_field/fasttoggle_field.module
Get the labels for this entity type.

File

module/fasttoggle_field/fasttoggle_field.module, line 25

Code

function fasttoggle_fasttoggle_field_access($object, $type, $group, $fieldname = NULL) {
  $result = FALSE;
  switch ($type) {
    case 'node':
      $result = node_access('update', $object);
      break;
    case 'profile2':
      $result = field_access('edit', field_info_field($fieldname), 'profile2', $object);
      break;
  }
  return $result ? FASTTOGGLE_ACCESS_ALLOWED : FASTTOGGLE_ACCESS_DENIED;
}