You are here

function views_theme_wizard_example_field in Views (for Drupal 7) 5

1 call to views_theme_wizard_example_field()
views_theme_wizard_form in ./views_theme_wizard.module

File

./views_theme_wizard.module, line 248

Code

function views_theme_wizard_example_field($view) {
  $fieldname = 'phptemplate_views_handle_field_' . $view->name . '_' . $view->field[0]['queryname'];
  $output = <<<EOT
/**
 * Function to handle a sample field.
 */
function {<span class="php-variable">$fieldname</span>}(\$fields, \$field, \$data) {
  \$info = \$fields[\$field['fullname']];

  if (\$field['handler'] && function_exists(\$field['handler'])) {
    return \$field['handler'](\$info, \$field, \$data->\$field['queryname'], \$data);
  }

  if (\$info['handler'] && is_string(\$info['handler']) && function_exists(\$info['handler'])) {
    return \$info['handler'](\$info, \$field, \$data->\$field['queryname'], \$data);
  }

  return check_plain(\$data->\$field['queryname']);
}
EOT;
  return $output;
}