You are here

function content_profile_theme_variables::get_variables in Content Profile 6

Gets all template variables for the content profile of this type.

Parameters

$type: The type of the user's content profile

$teaser: Whether the value is to be generated for the teaser.

$page: Whether the value is to be generated for the page view.

Return value

An array of variables available for the profile node or FALSE if there has been no profile created yet.

1 call to content_profile_theme_variables::get_variables()
content_profile_theme_variables::get_variable in ./content_profile.theme_vars.inc
Gets a single template variable for the content profile of this type.

File

./content_profile.theme_vars.inc, line 48
Provides a helper class for lazy loading of variables for themes.

Class

content_profile_theme_variables
A helper class, which offers lazy loading of variables for themes.

Code

function get_variables($type, $teaser = FALSE, $page = FALSE) {
  if (!isset($this->_cache[$type][$teaser][$page])) {
    $this->_cache[$type][$teaser][$page] = FALSE;
    if ($node = content_profile_load($type, $this->uid)) {

      // Make sure the node is prepared for viewing
      $node = node_build_content($node, $teaser, $page);
      $vars = array(
        'node' => $node,
        'teaser' => $teaser,
        'page' => $page,
      );

      // Apply all node template preprocessors
      foreach ($this
        ->_get_node_preprocessors() as $function) {
        if (function_exists($function)) {
          $function($vars, 'node');
        }
      }
      $this->_cache[$type][$teaser][$page] = $vars;
    }
  }
  return $this->_cache[$type][$teaser][$page];
}