You are here

function wfm_webform_component_presave in Webform Multiple (WFM) 7

Implements hook_webform_component_presave().

Save the component's multiple-values settings.

File

./wfm.module, line 57
Main module file for Webform Multiple (WFM).

Code

function wfm_webform_component_presave(&$component) {
  if (!isset($component['wfm']['max_items'])) {
    return;
  }
  $max_items = $component['wfm']['max_items'];
  $component['extra']['wfm_max_items'] = $max_items;
  $min_items = $component['wfm']['min_items'];

  // The minimum number of items cannot be greater than the maximum.
  if ($max_items != WFM_UNLIMITED && $min_items > $max_items) {
    $min_items = $max_items;
  }
  $component['extra']['wfm_min_items'] = $min_items;
  $component['extra']['wfm_add_more_text'] = $component['wfm']['add_more_text'];
}