You are here

function yashare_services_tableselect_pre_render in Yandex.Share 7.2

Pre-render callback helper.

2 calls to yashare_services_tableselect_pre_render()
yashare_block_services_pre_render in ./yashare.admin.inc
Pre-render callback for the block services tableselect.
yashare_popup_services_pre_render in ./yashare.admin.inc
Pre-render callback for the popup services tableselect.

File

./yashare.admin.inc, line 242
Administration pages for the Yandex.Share module.

Code

function yashare_services_tableselect_pre_render($element, $type) {

  // Add weight column.
  $element['#header']['weight'] = t('Weight');
  foreach (array_keys($element['#options']) as $codename) {
    $key = $codename . '_' . $type . '_weight';
    $element['#options'][$codename]['weight'] = array(
      'data' => drupal_render($element[$key]),
    );
    unset($element[$key]);
  }

  // Assign id to the table.
  $table_id = 'yashare-' . $type . '-services';
  $element['#attributes'] = array(
    'id' => $table_id,
  );
  drupal_add_tabledrag($table_id, 'order', 'sibling', 'yashare-' . $type . '-services-weight');
  return $element;
}