You are here

function mvf_unit_suggester_info in Measured Value Field 7

Collect information about a single unit suggester and its settings.

Parameters

array $plugin: cTools plugin definition of the unit suggester that should be retrieved

array $field: Field definition array of the MVF field from which to retrieve the information

array $instance: Field instance definition array of the MVF instance from which to retrieve the information

string $view_mode: Particular view mode for which to retrieve the information. You may omit this argument and the unit suggester info will be retrieved from general MVF instance settings

Return value

array Array of information about the settings of the requested unit suggester. It will have the following structure:

  • enable: (bool) whether it is enabled
  • weight: (int) weight of the unit suggester compared to other unit suggesters
  • ... Different unit suggesters might keep any additional settings here, which varies on per unit suggester basis
2 calls to mvf_unit_suggester_info()
mvf_field_update_instance in ./mvf.module
Implements hook_field_update_instance().
mvf_unit_suggester_per_user_disabled in mvf_per_user/plugins/unit_suggesters/per_user.inc
Notification for unit suggester that it was disabled in some formatter.

File

./mvf.module, line 1705
Define a field type of measured value.

Code

function mvf_unit_suggester_info($plugin, $field, $instance, $view_mode = NULL) {
  $plugin_name = mvf_unit_suggesters_settings_name($plugin);
  $unit_suggester_settings = $instance['settings']['mvf']['unit_suggesters_settings'];
  if ($view_mode && isset($instance['display'][$view_mode]['settings']['mvf']['override']) && $instance['display'][$view_mode]['settings']['mvf']['override']) {
    $unit_suggester_settings = $instance['display'][$view_mode]['settings']['mvf']['unit_suggesters_settings'];
  }
  return isset($unit_suggester_settings[$plugin_name]) ? $unit_suggester_settings[$plugin_name] : array(
    'enable' => FALSE,
    'weight' => 0,
  );
}