function hansel_ui_test_form in Hansel breadcrumbs 8
Same name and namespace in other branches
- 7 hansel_ui/hansel_ui.test.inc \hansel_ui_test_form()
Menu callback to generate the Hansel test form.
Parameters
array $form_state:
Return value
array
1 string reference to 'hansel_ui_test_form'
- _hansel_ui_menu in hansel_ui/
hansel_ui.registry.inc - Registry function for hook_menu().
File
- hansel_ui/
hansel_ui.test.inc, line 14 - Hansel test page
Code
function hansel_ui_test_form($form, $form_state) {
$form = array();
$path = empty($form_state['values']['path']) ? base64_decode(arg(5)) : $form_state['values']['path'];
$form['input'] = array(
'#type' => 'fieldset',
'#title' => t('Test input'),
);
$form['input']['path'] = array(
'#type' => 'textfield',
'#title' => t('Path'),
'#default_value' => $path,
);
$form['input']['submit'] = array(
'#type' => 'submit',
'#value' => t('Test'),
'#ajax' => array(
'callback' => 'hansel_ui_test_form_ajax',
'wrapper' => 'hansel-output',
'effect' => 'fade',
),
);
$form['output'] = array(
'#prefix' => '<div id="hansel-output">',
'#suffix' => '</div>',
);
if (!isset($form_state['values']) && arg(5) == '') {
$form['output']['info'] = array(
// It is important to have any content in the wrapper, otherwise the
// wrapper will not be displayed resulting in ahah malfunction
'#value' => ' ',
);
}
else {
_hansel_set_test_path($path);
$breadcrumbs = hansel_get_breadcrumbs(TRUE);
global $_hansel_test_messages;
$breadcrumbs = is_array($breadcrumbs['breadcrumb']) ? implode(' » ', $breadcrumbs['breadcrumb']) : t('Restore old breadcrumbs');
$form['output']['breadcrumbs'] = array(
'#type' => 'fieldset',
'#title' => t('Breadcrumbs'),
);
$form['output']['breadcrumbs']['output'] = array(
'#markup' => $breadcrumbs,
);
$form['output']['trace'] = array(
'#type' => 'fieldset',
'#title' => t('Trace'),
);
$form['output']['trace']['messages'] = array(
'#markup' => '<ul><li>' . implode('</li><li>', $_hansel_test_messages) . '</li></ul>',
);
}
return $form;
}