function finder_ui_element_form in Finder 7.2
Finder UI element form.
Parameters
$form: The form array.
&$form_state: The form state array.
Return value
The form.
1 string reference to 'finder_ui_element_form'
- finder_ui_element_page in modules/
finder_ui/ includes/ element.inc - Finder UI element page.
File
- modules/
finder_ui/ includes/ element.inc, line 85
Code
function finder_ui_element_form($form, &$form_state) {
$feid =& $form_state['feid'];
$finder =& $form_state['finder'];
if ($feid != 'new') {
$element =& $finder->elements[$feid];
}
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => !empty($element->title) ? $element->title : NULL,
'#size' => 40,
'#maxlength' => 255,
'#required' => TRUE,
'#description' => t('The label on the form element.'),
);
$form['id'] = array(
'#type' => 'machine_name',
'#default_value' => !empty($element->id) ? $element->id : NULL,
'#maxlength' => 64,
'#machine_name' => array(
'source' => array(
'title',
),
'exists' => 'finder_ui_element_exists',
),
);
$element_help = '';
$element_help_list = finder_ui_get_element_help();
foreach ($element_help_list as $type => $help_list) {
$element_help .= '<strong>' . $type . '</strong>';
$element_help .= theme('item_list', array(
'items' => $help_list,
));
$element_help .= '<br>';
}
$form['element'] = array(
'#type' => 'select',
'#title' => t('Element'),
'#default_value' => !empty($element->element) ? $element->element : NULL,
'#options' => finder_ui_get_element_options(),
'#required' => TRUE,
'#empty_option' => ' - ' . t('Choose an element') . ' - ',
'#description' => '<p>' . t('Choose a form element, or a container to group child elements. The ' . 'drag and drop list of elements can be organized like a tree when ' . 'using containers, by indenting child elements to the right.') . '</p>' . $element_help,
);
/*
// This doesn't correctly reflect the drag-n-drop, so it screws things up
// Perhaps we need an 'operations' link on the finder admin page to manually
// set weights and tree structure
$potential_parents = array();
foreach ($finder->elements as $finder_element) {
if ($finder_element->id != $element->id && $finder_element->element_handler['type'] == 'container') {
$hyphens = '';
for ($i = 0; $i <= $finder->element_depth($finder_element); $i++) {
$hyphens .= '-';
}
$potential_parents[$finder_element->id] = $hyphens . ' ' . $finder_element->title;
}
}
if (count($potential_parents)) {
$form['parent'] = array(
'#type' => 'select',
'#title' => t('Parent'),
'#default_value' => $element->parent,
'#options' => $potential_parents,
'#empty_option' => ' - ' . t('None') . ' - ',
);
}
*/
// Add buttons.
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Apply'),
);
$form['actions']['cancel'] = array(
'#type' => 'submit',
'#value' => t('Cancel'),
);
$form['#pre_render'] = array(
'finder_ui_modal_form_pre_render',
);
return $form;
}