Skip to content

Instantly share code, notes, and snippets.

@Greg-Boggs
Last active August 29, 2015 13:57
Show Gist options
  • Save Greg-Boggs/9652915 to your computer and use it in GitHub Desktop.
Save Greg-Boggs/9652915 to your computer and use it in GitHub Desktop.
<?php
function web2theme_preprocess_user_profile(&$variables) {
if( arg(2)==null ) { //im not editing
$qty_field=count($variables['user_profile']['field_telefone']['#items']);
for($i=0 ; $i<$qty_field; $i++) {
$field_collection_id = $variables['field_telefone'][$i]['value'];
//dsm($variables['user_profile']['field_telefone'][$i]['entity']['field_collection_item'][$field_collection_id]['field_telefone_showed']);
$toshow = $variables['user_profile']['field_telefone'][$i]['entity']['field_collection_item'][$field_collection_id]['field_telefone_showed'];
//dsm($variables['user_profile']['field_telefone'][$i]['entity']['field_collection_item'][$field_collection_id]['field_telefone_showed']['#items'][0]['value']);
dsm($toshow['#items'][0]['value']);
if( $toshow['#items'][0]['value'] == 0 ) {
//$variables['user_profile']['field_telefone'][$i]['entity']['field_collection_item'][$field_collection_id]['field_telefone_number']
$variables['elements']['field_telefone']['#access'] = FALSE;
}
}
dsm($variables);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment