You are here

function views_customfield_handler_field_phpcode::render_phpcode in Views Custom Field 6

Prepare and evaluate of a string of PHP code.

This method and eval_phpcode are mostly a copy of drupal_eval().

Parameters

string $code:

mixed $static:

array $data:

Return value

string

1 call to views_customfield_handler_field_phpcode::render_phpcode()
views_customfield_handler_field_phpcode::render_row in includes/views_customfield_handler_field_phpcode.inc
Enter description here...

File

includes/views_customfield_handler_field_phpcode.inc, line 174
Contains the 'customfield' phpcode field handler.

Class

views_customfield_handler_field_phpcode

Code

function render_phpcode($code, &$static, $data) {
  global $theme_path, $theme_info, $conf;

  // Store current theme path.
  $old_theme_path = $theme_path;

  // Restore theme_path to the theme, as long as drupal_eval() executes,
  // so code evaluted will not see the caller module as the current theme.
  // If theme info is not initialized get the path from theme_default.
  if (!isset($theme_info)) {
    $theme_path = drupal_get_path('theme', $conf['theme_default']);
  }
  else {
    $theme_path = dirname($theme_info->filename);
  }
  $output = $this
    ->eval_phpcode($code, $static, $data);

  // Recover original theme path.
  $theme_path = $old_theme_path;
  return $output;
}