function theme_drop_down_login_dragandrop in Drop Down Login 7
Theme for make our multifield draggable.
File
- ./
drop_down_login.module, line 307 - Module file for Drop Down Login.
Code
function theme_drop_down_login_dragandrop($variables) {
$element = $variables['element'];
$output = '';
$rows = array();
foreach (element_children($element) as $id) {
if (!empty($element[$id]['menu']) && !empty($element[$id]['weight'])) {
$rows[$id]['data']['menu'] = drupal_render($element[$id]['menu']);
$rows[$id]['data']['weight'] = drupal_render($element[$id]['weight']);
$rows[$id]['class'][] = 'draggable';
}
}
// We now define the table header values. Ensure that the 'header' count
// matches the final column count for your table.
$header = array(
t('Menu'),
t('Weight'),
);
// Aet a uniq id for this table.
$table_id = 'drop-down-login-multifield-table_' . $element['#id'];
// We can now render our tabledrag table for output.
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => $table_id,
),
));
// Just in case...
$output .= drupal_render_children($element);
// Include js.
drupal_add_tabledrag($table_id, 'order', 'sibling', 'drop-down-login-item-weight');
return $output;
}