function finder_select_element in Finder 7.2
Element callback.
1 string reference to 'finder_select_element'
- select.inc in plugins/
element_handler/ select.inc - The finder select element handler plugin.
File
- plugins/
element_handler/ select.inc, line 102 - The finder select element handler plugin.
Code
function finder_select_element($element, &$form_element, $form_state) {
$finder = $element->finder;
$properties = array();
$form_element['#type'] = 'select';
$properties = array(
'multiple',
'size',
);
if ($finder
->esetting($element, 'multiple')) {
if (!is_array($form_element['#default_value'])) {
$form_element['#default_value'] = explode("\n", $form_element['#default_value']);
}
}
if (isset($properties)) {
foreach ($properties as $property) {
$form_element['#' . $property] = $finder
->esetting($element, $property);
}
}
$finder->find = array(
'mode' => 'choices',
'keywords' => array(
$element->id => array(
NULL,
),
),
'element' => $element,
);
$finder
->find();
$form_element['#options'] = !empty($finder->find['results']) ? $finder->find['results'] : array();
if ($finder
->esetting($element, 'empty')) {
$empty = array(
'' => $finder
->esetting($element, 'empty_text'),
);
if ($finder
->esetting($element, 'empty') == 'prepend') {
$form_element['#options'] = $empty + $form_element['#options'];
}
elseif ($finder
->esetting($element, 'empty') == 'append') {
$form_element['#options'] = $form_element['#options'] + $empty;
}
}
$form_element['#element_validate'][] = 'finder_select_element_validate';
}