I have my field tpl file which sets in a div classes 'field-item', 'odd/even' etc. I need to dynamically assign a class to it based on the regions that exist on the page. I am using bootstrap theme and the class I need to add reflects the column span count, so f I have a sidebar on the left I will have less space for that field and need a narrower column class.
Bootstrap already comes with a function doing it for page preprocess:
function mytheme_preprocess_page(&$variables) {
// Add information about the number of sidebars.
if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) {
$variables['columns'] = 3;
}
elseif (!empty($variables['page']['sidebar_first'])) {
$variables['columns'] = 2;
}
elseif (!empty($variables['page']['sidebar_second'])) {
$variables['columns'] = 2;
}
else {
$variables['columns'] = 1;
}
So basically what I need is to make my field aware of that page variable. How can I use this variable on my field tpl file?