function crm_core_match_admin_config_engines_form in CRM Core 7
Matching Engines form.
1 string reference to 'crm_core_match_admin_config_engines_form'
- crm_core_match_menu in modules/
crm_core_match/ crm_core_match.module - Implements hook_menu().
File
- modules/
crm_core_match/ crm_core_match.admin.inc, line 11 - Administrative forms.
Code
function crm_core_match_admin_config_engines_form($form, &$form_state) {
$form['header'] = array(
'#prefix' => '<h2>',
'#markup' => t('Matching Engines'),
'#suffix' => '</h2>',
);
$form['description_wrapper'] = array(
'#type' => 'container',
);
$description = 'Configure matching engines for contacts. Matching engines are used when new contacts are created,' . ' allowing CRM Core to identify potential duplicates and prevent additional records from being added to the' . ' system. Use this screen to activate / deactivate various matching engines and control the order in which they' . ' are applied.';
$form['description_wrapper']['description'] = array(
'#markup' => t($description),
);
$form['engines_container'] = array(
'#type' => 'container',
'#tree' => TRUE,
);
$engines = crm_core_match_get_engines();
$form_state['engines'] = $engines;
foreach ($engines as $engine) {
$form['engines_container'][$engine
->getMachineName()]['name'] = array(
'#markup' => $engine
->getName(),
);
$form['engines_container'][$engine
->getMachineName()]['description'] = array(
'#markup' => $engine
->getDescription(),
);
$status_toggle_path = 'admin/config/crm-core/match/engines/' . $engine
->getMachineName() . '/';
$status_toggle_path .= $engine
->getStatus() ? 'disable' : 'enable';
$destination = drupal_get_destination();
$form['engines_container'][$engine
->getMachineName()]['enabled'] = array(
'#markup' => l($engine
->getStatus() ? t('Disable') : t('Enable'), $status_toggle_path, array(
'query' => array(
'destination' => $destination['destination'],
),
)),
);
// Operations links.
$links = array();
foreach ($engine
->getSettings() as $item) {
$links[$item['name']] = array(
'title' => $item['label'],
'href' => $item['path'],
);
}
$form['engines_container'][$engine
->getMachineName()]['settings'] = array(
'#theme' => 'links',
'#links' => $links,
'#attributes' => array(
'class' => array(
'links',
'inline',
),
),
);
$form['engines_container'][$engine
->getMachineName()]['weight'] = array(
'#type' => 'weight',
'#title_display' => 'invisible',
'#default_value' => $engine
->getWeight(),
'#attributes' => array(
'class' => array(
'crm-core-match-engine-order-weight',
),
),
);
}
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}