function uc_ajax_admin_table in Ubercart 7.3
Same name and namespace in other branches
- 8.4 uc_ajax_admin/uc_ajax_admin.module \uc_ajax_admin_table()
TAPIr table callback for the uc_ajax administrative form.
Parameters
$trigger_options: The select options for triggering elements.
$wrapper_options: The select options for wrappers.
$config: The existing configuration.
1 string reference to 'uc_ajax_admin_table'
- uc_ajax_admin_form in uc_ajax_admin/
uc_ajax_admin.module - Administration form for uc_ajax.
File
- uc_ajax_admin/
uc_ajax_admin.module, line 105 - Configures Ajax behaviours on the Ubercart checkout page.
Code
function uc_ajax_admin_table($trigger_options, $wrapper_options, $config) {
$rows = array();
foreach ($config as $key => $panes) {
list(, $pane) = explode('][', $key);
$rows[] = array(
'key' => array(
'#type' => 'hidden',
'#value' => $key,
'#suffix' => empty($trigger_options[ucfirst($pane)][$key]) ? $key : ucfirst($pane) . ': ' . $trigger_options[ucfirst($pane)][$key],
),
'panes' => array(
'#type' => 'select',
'#options' => $wrapper_options,
'#default_value' => $panes,
'#multiple' => TRUE,
),
'remove' => array(
'#type' => 'checkbox',
'#default_value' => FALSE,
),
);
}
$rows['_new'] = array(
'key' => array(
'#type' => 'select',
'#options' => array(
0 => t('--Add a new element--'),
) + $trigger_options,
),
'panes' => array(
'#type' => 'select',
'#options' => $wrapper_options,
'#multiple' => TRUE,
),
'remove' => array(
'#type' => 'hidden',
'#value' => 0,
),
);
$table = array(
'#type' => 'tapir_table',
'#tree' => TRUE,
'#columns' => array(
'remove' => array(
'cell' => t('Remove'),
'weight' => 3,
),
'key' => array(
'cell' => t('Triggering form element'),
'weight' => 1,
),
'panes' => array(
'cell' => t('Panes to update'),
'weight' => 2,
),
),
) + $rows;
return $table;
}