function theme_ds_field_expert in Display Suite 7
Same name and namespace in other branches
- 7.2 modules/ds_extras/ds_extras.module \theme_ds_field_expert()
Custom output all HTML for the field.
2 string references to 'theme_ds_field_expert'
- dsNodeTests::testDSFieldTemplate in tests/
ds.entities.test - Tests on field templates.
- ds_extras_ds_field_settings_alter in modules/
ds_extras/ ds_extras.admin.inc - Implements hook_ds_field_settings_alter().
File
- modules/
ds_extras/ ds_extras.module, line 431 - Display Suite extras main functions.
Code
function theme_ds_field_expert($variables) {
$output = '';
$config = $variables['ds-config'];
// Render the label if it's not hidden
if (!$variables['label_hidden']) {
if (isset($config['lb-el'])) {
if (!empty($config['lb-cl'])) {
$class = ' class="label-' . $variables['element']['#label_display'] . ' ' . $config['lb-cl'] . '"';
}
else {
$class = ' class="label-' . $variables['element']['#label_display'] . '"';
}
$output .= '<' . $config['lb-el'] . $class . '>' . $variables['label'];
if (!isset($config['lb-col'])) {
$output .= ': ';
}
$output .= '</' . $config['lb-el'] . '>';
}
else {
$output .= '<div class="label-' . $variables['element']['#label_display'] . '">' . $variables['label'];
if (!isset($config['lb-col'])) {
$output .= ': ';
}
$output .= '</div>';
}
}
// Field items wrapper
if (isset($config['fis'])) {
$fis_wrapper = $config['fis-el'];
$class = !empty($config['fis-cl']) ? ' class="' . $config['fis-cl'] . '"' : '';
$output .= '<' . $fis_wrapper . $class . '>';
}
// Field item wrapper.
if (isset($config['fi'])) {
$fi_wrapper = $config['fi-el'];
}
// Render items.
foreach ($variables['items'] as $delta => $item) {
// Field item wrapper.
if (isset($config['fi'])) {
$classes = $delta % 2 ? 'odd' : 'even';
if (!empty($config['fi-cl'])) {
$classes .= ' ' . $config['fi-cl'];
}
$output .= '<' . $fi_wrapper . ' class="' . $classes . '">';
}
// Render field content.
$output .= drupal_render($item);
// Closing field item wrapper.
if (isset($config['fi'])) {
$output .= '</' . $fi_wrapper . '>';
}
}
// Closing field items wrapper.
if (isset($config['fis'])) {
$output .= '</' . $fis_wrapper . '>';
}
// Outer wrapper.
if (isset($config['ow'])) {
$ow_wrapper = $config['ow-el'];
$class = !empty($config['ow-cl']) ? ' class="' . $config['ow-cl'] . '"' : '';
$output = '<' . $ow_wrapper . $class . '>' . $output . '</' . $ow_wrapper . '>';
}
return $output;
}