This does need to be:

`if (!empty($tabs['#primary'][0])):`