How to check if field is empty and hide a css class in render array? I am new to drupal core development any help will be much appreciated.
I have a tab group from content type hidden from anonymous users (by default) when the field content within the tab is empty, how do I hide this tab when login in editors are viewing the same content.

This is what I have done so far in my node.inc using template_preprocess_node

function template_preprocess_node__event(&amp;$variables, $hook) 
{
//  kpr($variables);
$node = $variables['node'];
//  kpr($node);
$custom_tab = field_get_items('node', $variables['node'], 'field_route_text');
$custom_tab = (!empty($custom_tab)) ? kpr ('not empty from node') :  kpr('empty from node');

// jQuery UI accordion lib
drupal_add_library('system', 'ui.accordion');
}
I achieved this by the code below;

    function template_preprocess_node__event(&amp;$variables, $hook) {
    $node = $variables['node'];
    $custom_tab = field_get_items('node', $variables['node'],    'field_override_group_label')
    if (! isset($custom_tab[0]['safe_value'])){
        drupal_add_css(drupal_get_path('theme', 'template some ') . "/css/customtab.css");
    }
    // jQuery UI accordion lib
    drupal_add_library('system', 'ui.accordion');
}


In customtab.css file, I add a css to hide the class. 
I think this might have impact on the general site performance.