You are here

function term_merge_merge_options_submit in Term Merge 7

Return merge settings array.

Output of this function should be used for supplying into term_merge() function or for triggering actions_do('term_merge_action', ...) action. This function should be invoked in a form submit handler for a form that used term_merge_merge_options_elements() for generating merge settings elements. It will process data and return an array of merge settings, according to the data user has submitted in your form.

Parameters

array $merge_settings_element: That part of form that was generated by term_merge_merge_options_elements()

array $form_state: Form state array of the submitted form

array $form: Form array of the submitted form

Return value

array Array of merge settings that can be used for calling term_merge() or invoking 'term_merge_action' action

See also

term_merge_merge_options_elements()

3 calls to term_merge_merge_options_submit()
term_merge_action_submit in ./term_merge.module
Form submission function.
term_merge_duplicates_form_submit in ./term_merge.pages.inc
Submit handler for 'term_merge_duplicates_form'.
term_merge_form_submit in ./term_merge.pages.inc
Submit handler for term_merge_form(). Merge terms one into another.

File

./term_merge.module, line 821
Provide functionality for merging taxonomy terms one into another.

Code

function term_merge_merge_options_submit($merge_settings_element, &$form_state, $form) {
  $merge_settings = array(
    'term_branch_keep' => (bool) $merge_settings_element['term_branch_keep']['#value'],
    'merge_fields' => isset($merge_settings_element['merge_fields']['#value']) ? array_values(array_filter($merge_settings_element['merge_fields']['#value'])) : array(),
    'keep_only_unique' => (bool) $merge_settings_element['keep_only_unique']['#value'],
    'redirect' => isset($merge_settings_element['redirect']['#value']) ? $merge_settings_element['redirect']['#value'] : TERM_MERGE_NO_REDIRECT,
    'synonyms' => isset($merge_settings_element['synonyms']['#value']) ? $merge_settings_element['synonyms']['#value'] : NULL,
    'step' => (int) $merge_settings_element['step']['#value'],
  );
  return $merge_settings;
}