Where are variables such as page, messages and tabs set?

For example, where is the tabs variable from the following syntax (excluding the word "and" and the whitespace before and after it) set (initially)?:
if ($tabs):

and

print render($tabs);

If my question is unclear, in any way, please let me know so that I can make it clearer.

Any input would be GREATLY appreciated!

Comments

Jaypan’s picture

One of two places. Either the variable is defined in hook_theme, and is passed to the theme implementation when it is invoked, or else the variable is generated in a _preprocess function for the theme hook in question.

rajagopalu.manyam’s picture

$tabs is set in template_preprocess_page()

$page array contains top level elements for each block region
ex:
$page['page_top']
$page['header']
$page['sidebar_first']
$page['content']
$page['sidebar_second']
$page['page_bottom']
See this function for reference template_preprocess_page(&$variables)