You are here

function _mvf_unit_suggester_process in Measured Value Field 7

Form API process function for 'mvf_unit_suggester' form element.

1 string reference to '_mvf_unit_suggester_process'
mvf_element_info in ./mvf.module
Implements hook_element_info().

File

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

Code

function _mvf_unit_suggester_process($element) {
  $measure = mvf_measure_extract($element['#field']);
  foreach (mvf_unit_suggesters_info($element['#field'], $element['#instance'], $element['#view_mode']) as $info) {
    $unit_suggester_settings_name = mvf_unit_suggesters_settings_name($info['plugin']);

    // Letting unit suggester provide some configuration form elements of its
    // own.
    $function = ctools_plugin_get_function($info['plugin'], 'settings form callback');
    if ($function) {
      $element[$unit_suggester_settings_name] = $function($measure, $element['#field'], $element['#instance'], $info['settings'], $info['plugin']);
    }
    $element[$unit_suggester_settings_name]['weight'] = array(
      '#type' => 'weight',
      '#title' => t('Weight'),
      '#default_value' => $info['settings']['weight'],
    );
    $element[$unit_suggester_settings_name]['enable'] = array(
      '#type' => 'checkbox',
      '#title' => $info['plugin']['title'],
      '#default_value' => $info['settings']['enable'],
    );
  }
  return $element;
}