You are here

function theme_socialfield_formatter in Social field 7

Custom theme output for the formatter.

1 theme call to theme_socialfield_formatter()
socialfield_field_formatter_view in ./socialfield.module
Implements hook_field_formatter_view().

File

./socialfield.module, line 969
Provides a field for adding social services links.

Code

function theme_socialfield_formatter($variables) {
  $label = array();
  $label_class = '';
  if (isset($variables['label']['mode']) && $variables['label']['mode'] != 'hidden') {
    $label = array(
      '#markup' => $variables['label']['label'],
      '#prefix' => '<div class="field-label">',
      '#suffix' => '</div>',
    );
    switch ($variables['label']['mode']) {
      case 'above':
        $label_class = 'field-label-above';
        break;
      case 'inline':
        $label_class = 'field-label-inline';
        break;
      case 'hidden':
        $label_class = 'field-label-hidden';
        break;
    }
  }
  $label = drupal_render($label);
  $list = theme('item_list', array(
    'items' => $variables['items'],
    'attributes' => array(
      'class' => array(
        'field-items',
      ),
    ),
  ));
  $field_classes = array(
    'field',
    'field-name-' . str_replace('_', '-', $variables['field']['field_name']),
    'field-type-' . str_replace('_', '-', $variables['field']['type']),
    $label_class,
    'social-links',
  );
  return '<div class="' . implode(' ', $field_classes) . '">' . $label . $list . '</div>';
}