function theme_context_block_regions_form in Context 6
Same name and namespace in other branches
- 6.3 theme/context_reaction_block.theme.inc \theme_context_block_regions_form()
- 7.3 theme/context_reaction_block.theme.inc \theme_context_block_regions_form()
Generates the AJAX enabled block administration portion of the context_ui admin form.
1 theme call to theme_context_block_regions_form()
- context_reaction_block::options_form in plugins/
context_reaction_block.inc - Options form.
File
- theme/
context_reaction_block.theme.inc, line 25
Code
function theme_context_block_regions_form($vars) {
$form = $vars['form'];
// Add draggable weights
drupal_add_js('misc/tableheader.js');
drupal_add_js(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.js');
drupal_add_css(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.css');
$output = '';
foreach (element_children($form) as $region) {
$attr = array(
'id' => "context-blockform-region-{$region}",
'class' => array(
"context-blockform-region",
),
);
drupal_add_tabledrag($attr['id'], 'order', 'sibling', 'block-weight', NULL, NULL, FALSE);
$rows = array();
foreach (element_children($form[$region]) as $id) {
$form[$region][$id]['weight']['#attributes'] = array(
'class' => array(
'block-weight',
),
);
$label = $form[$region][$id]['#value'];
$remove = l('X', $_GET['q'], array(
'fragment' => 'remove',
'attributes' => array(
'class' => array(
'remove',
),
),
));
$rows[] = array(
'data' => array(
$label . drupal_render($form[$region][$id]['weight']),
$remove,
),
'class' => array(
'draggable',
),
'id' => $id,
);
}
$output .= "<div class='label context-blockform-regionlabel-{$region}'>";
$output .= l('+ ' . t('Add'), $_GET['q'], array(
'fragment' => $region,
'attributes' => array(
'class' => array(
'add-block',
),
),
));
$output .= $form[$region]['#title'];
$output .= "</div>";
$output .= theme('table', array(
'rows' => $rows,
'attributes' => $attr,
));
}
return $output;
}