function commons_origins_preprocess_field in Drupal Commons 7.3
Implements hook_preprocess_field().
File
- themes/
commons/ commons_origins/ template.php, line 1090 - Process theme data.
Code
function commons_origins_preprocess_field(&$variables, $hook) {
// Style the trusted contact link like a button.
if (isset($variables['element']['#formatter']) && $variables['element']['#formatter'] == 'trusted_contact') {
foreach ($variables['items'] as &$container) {
foreach (element_children($container) as $index) {
$item =& $container[$index];
if (isset($item['#options'])) {
$item['#options']['attributes']['class'][] = 'action-item-small';
}
if (isset($item['#href']) && strpos($item['#href'], 'messages')) {
$item['#options']['attributes']['class'][] = 'message-contact';
}
elseif (isset($item['#href'])) {
$item['#options']['attributes']['class'][] = 'trusted-status-request';
}
}
}
}
}