You are here

function _field_weight_field_instance_get_weight in Field display weights (per node) 7.2

Determine the default weight set for the field. This only checks the 'default' and 'full' keys.

Parameters

$instance The field instance as returned by field_info_instances(): (or, in our case, _field_weight_field_info_instances()).

1 call to _field_weight_field_instance_get_weight()
field_weight_sort_instances in ./field_weight.module

File

./field_weight.module, line 443
Field display weight module.

Code

function _field_weight_field_instance_get_weight(array $instance) {
  if (isset($instance['display'])) {
    foreach ($instance['display'] as $display_key => $view_mode) {
      if (in_array($display_key, array(
        'default',
        'full',
      ))) {
        if (isset($view_mode['weight'])) {
          return $view_mode['weight'];
        }
      }
    }
  }
  return FALSE;
}