You are here

function theme_social_media_links_platforms_table in Social Media Links Block and Field 7

Returns HTML for the platform table with tabledrag.

1 theme call to theme_social_media_links_platforms_table()
social_media_links_form in ./social_media_links.module

File

./social_media_links.module, line 661
Functions for the Social Media Links module.

Code

function theme_social_media_links_platforms_table(&$variables) {
  $form = $variables['form'];
  $rows = array();
  foreach (element_children($form) as $platform) {
    $form[$platform]['weight']['#attributes']['class'] = array(
      'platforms-order-weight',
    );
    $rows[] = array(
      'data' => array(
        '<strong>' . $form[$platform]['platform_value']['#title'] . '<strong>',
        array(
          'class' => array(
            'platform-cross',
          ),
          'data' => drupal_render($form[$platform]['platform_value']),
        ),
        array(
          'class' => array(
            'tabledrag-hide',
          ),
          'data' => drupal_render($form[$platform]['weight']),
        ),
      ),
      'class' => array(
        'draggable',
      ),
    );
  }
  $header = array(
    t('Platform'),
    '',
    array(
      'class' => array(
        'tabledrag-hide',
      ),
      'data' => t('Weight'),
    ),
  );
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'platforms-order',
    ),
  ));
  drupal_add_tabledrag('platforms-order', 'order', 'silbing', 'platforms-order-weight');
  return $output;
}