/**
 * Custom theme output for widget.
 */
function borg_socialfield_drag_components($variables)
{
    $element = $variables['element'];
    backdrop_add_tabledrag('socialfield-table', 'order', 'sibling', 'item-row-weight');
    $services = config_get('socialfield.settings', 'services');
    $header = array(t($element['#title']), '', '', '');
    $rows = array();
    $index = 0;
    for ($i = 0; $i < $element['#num_elements']; $i++) {
        while (!isset($element['element_' . $index])) {
            // There is no element with this index. Moving on to the next possible element.
            $index++;
        }
        $current_element = $element['element_' . $index];
        $rows[] = array('data' => array('<div class="social-links">' . '<span class="socialfield socialfield-' . $current_element['#service'] . '">' . '<i class="icon ' . $services[$current_element['#service']]['icon'] . '">' . t($services[$current_element['#service']]['name']) . '</i>' . '</span>' . '</div>', backdrop_render($current_element['url']), backdrop_render($current_element['weight']), backdrop_render($current_element['operation'])), 'class' => array('draggable'), 'weight' => $current_element['weight']['#value']);
        $index++;
    }
    // Sorting elements by their weight.
    backdrop_sort($rows, array('weight'));
    $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'socialfield-table')));
    $output .= '<div class="description">' . backdrop_render($element['description']) . '</div>';
    $output .= backdrop_render($element['add_one_social']);
    return $output;
}
 * Default theme implementation to configure Better Formats defaults admin page.
 *
 * Available variables:
 * - $form_submit: Form submit button.
 *
 * Each $node_default_rows contains a row
 *
 * Each $data in $node_default_rows contains:
 * - $data->role: Role name.
 * - $data->format_select: Drop-down menu for setting format.
 * - $data->weight_select: Drop-down menu for setting weights.
 */
// Add table javascript
backdrop_add_tabledrag('node-format-defaults', 'order', 'sibling', 'better-formats-role-node-weight');
backdrop_add_tabledrag('comment-format-defaults', 'order', 'sibling', 'better-formats-role-comment-weight');
backdrop_add_tabledrag('block-format-defaults', 'order', 'sibling', 'better-formats-role-block-weight');
?>
<div class="description">
  <?php 
print '<p><strong>' . t('Defaults only affect NEW content NOT existing content.') . '</strong></p>';
?>
  <?php 
print '<p><strong>' . t('Place roles in order of precedence by dragging more important roles to the top.') . '</strong></p>';
?>
</div>
<fieldset>
  <legend><strong><?php 
print t('Node defaults');
?>
</strong></legend>
  <table id="node-format-defaults">