function hansel_ui_config_switch_form in Hansel breadcrumbs 7
Same name and namespace in other branches
- 8 hansel_ui/hansel_ui.module \hansel_ui_config_switch_form()
Generate the switch configuration form.
1 string reference to 'hansel_ui_config_switch_form'
- _hansel_ui_menu in hansel_ui/
hansel_ui.registry.inc - Registry function for hook_menu().
File
- hansel_ui/
hansel_ui.module, line 604 - Hansel UI module
Code
function hansel_ui_config_switch_form($form, &$form_state, $rid) {
// Store the rule id in a global var, will be used in hansel_ui_switch_configure_form().
global $_hansel_rid;
$_hansel_rid = $rid;
$sql = "SELECT r.rid, r.name, ras.handler as handler, ras.arguments as arguments\n FROM {hansel_rule} r\n JOIN {hansel_rule_action_switch} ras ON ras.rid = r.rid\n WHERE r.rid = :rid";
$res = db_query($sql, array(
':rid' => $rid,
));
if (!($rule = $res
->fetchObject())) {
drupal_set_message(t('No switch found for rule'), 'error');
drupal_goto('admin/config/search/hansel');
}
if (!_hansel_is_configurable_switch($rule->handler)) {
drupal_set_message(t('Invalid or non configurable switch handler'), 'error');
drupal_goto('admin/config/search/hansel');
}
$rule->arguments = empty($rule->arguments) ? array() : unserialize($rule->arguments);
$types = _hansel_get_switch_types();
return call_user_func($types[$rule->handler]['config form'], $rule->arguments);
}