function finder_buttons_element in Finder 7.2
Element callback.
1 string reference to 'finder_buttons_element'
- buttons.inc in plugins/
element_handler/ buttons.inc - The finder buttons element handler plugin.
File
- plugins/
element_handler/ buttons.inc, line 83 - The finder buttons element handler plugin.
Code
function finder_buttons_element($element, &$form_element, $form_state) {
$finder = $element->finder;
$properties = array();
if ($finder
->esetting($element, 'multiple')) {
$form_element['#type'] = 'checkboxes';
if (!is_array($form_element['#default_value'])) {
$form_element['#default_value'] = explode("\n", $form_element['#default_value']);
}
}
else {
$form_element['#type'] = 'radios';
}
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_buttons_element_validate';
}