function finder_admin_custom_matching_entry in Finder 7
Build the form for a single entry.
Parameters
&$form: Reference to the form array to add the form to.
$key: The key of the match entry.
$value: The value of the match entry.
$default: Boolean indicating whether this is a default entry (vs. custom).
1 call to finder_admin_custom_matching_entry()
- finder_admin_custom_matching in includes/
finder.admin.inc - Finder admin custom matching configuration page.
File
- includes/
finder.admin.inc, line 1066 - The finder admin screens.
Code
function finder_admin_custom_matching_entry(&$form, $key, $value, $default) {
$form[$key] = array(
'#type' => 'fieldset',
);
$form[$key]['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#default_value' => isset($value['name']) ? $value['name'] : '',
'#size' => 20,
'#maxlength' => 128,
'#disabled' => $default,
'#field_suffix' => isset($value['name']) ? '<small class="finder-condition-machine-name"> (' . t('Machine name') . ': ' . $key . ')</small>' : '',
'#description' => $default ? '' : (isset($value['name']) ? t('Clear name to delete row.') : t('Enter name to create row.')),
);
$form[$key]['description'] = array(
'#type' => 'textfield',
'#title' => t('Description'),
'#default_value' => isset($value['description']) ? $value['description'] : '',
'#size' => 60,
'#maxlength' => 512,
'#disabled' => $default,
'#description' => $default ? '' : t('Explain, in these terms, how <em>!matches</em> relates to <em>!keywords</em>.'),
);
$form[$key]['operator'] = array(
'#type' => 'textfield',
'#title' => t('Operator'),
'#default_value' => isset($value['operator']) ? $value['operator'] : '',
'#size' => ($x = isset($value['operator']) ? min(drupal_strlen($value['operator']), 30) : 5) ? $x : 1,
'#maxlength' => 512,
'#field_prefix' => "'" . t('field') . "'",
'#disabled' => $default,
'#prefix' => '<div class="finder-condition"><span class="finder-condition-operator">',
'#suffix' => '</span>',
);
$form[$key]['value_prefix'] = array(
'#type' => 'textfield',
'#title' => t('Prefix'),
'#default_value' => isset($value['value_prefix']) ? $value['value_prefix'] : '',
'#size' => ($x = isset($value['value_prefix']) ? min(drupal_strlen($value['value_prefix']), 30) : 3) ? $x : 1,
'#maxlength' => 512,
'#field_suffix' => t('value'),
'#disabled' => $default,
'#prefix' => '<span class="finder-condition-value-prefix">',
'#suffix' => '</span>',
);
$form[$key]['value_suffix'] = array(
'#type' => 'textfield',
'#title' => t('Suffix'),
'#default_value' => isset($value['value_suffix']) ? $value['value_suffix'] : '',
'#size' => ($x = isset($value['value_suffix']) ? min(drupal_strlen($value['value_suffix']), 30) : 3) ? $x : 1,
'#maxlength' => 512,
'#disabled' => $default,
'#prefix' => '<span class="finder-condition-value-suffix">',
'#suffix' => '</span></div>',
);
}