You are here

function abt_remove_fields in Access By Term 7

4 calls to abt_remove_fields()
abt_form_node_form_alter in ./abt.module
Implements hook_form_BASE_FORM_ID_alter().
abt_form_user_profile_form_alter in ./abt.module
Implements hook_form_FORM_ID_alter().
abt_node_view in ./abt.module
Implements hook_node_view().
abt_user_view in ./abt.module
Implements hook_user_view().

File

./abt.module, line 303
abt.module Module for controling access by using user->term<-node relationship.

Code

function abt_remove_fields($data) {

  // Fetch field_names used with abt.
  $abt_fields = field_read_fields(array(
    'module' => 'taxonomy',
  ));
  foreach ($abt_fields as $field_name => $field) {
    if (array_key_exists('abt_map', $field['settings'])) {
      if (is_array($data)) {
        unset($data[$field_name]);
      }
      elseif (is_object($data) && property_exists($data, $field_name)) {
        unset($data->{$field_name});
      }
    }
  }
  return $data;
}