You are here

views-view-fields--homepage-group-showcase--block-1.tpl.php in Drupal Commons 6.2

views-view-fields.tpl.php Default simple view template to all the fields as a row.

  • $view: The view in use.
  • $fields: an array of $field objects. Each one contains:
    • $field->content: The output of the field.
    • $field->raw: The raw data for the field, if it exists. This is NOT output safe.
    • $field->class: The safe class id to use.
    • $field->handler: The Views field handler object controlling this field. Do not use var_export to dump this object, as it can't handle the recursion.
    • $field->inline: Whether or not the field should be inline.
    • $field->inline_html: either div or span based on the above flag.
    • $field->separator: an optional separator that may appear before a field.
  • $row: The raw result object from the query, with all data it fetched.

File

themes/commons_roots/views-view-fields--homepage-group-showcase--block-1.tpl.php
View source
<?php

// $Id: views-view-fields.tpl.php,v 1.6 2008/09/24 22:48:21 merlinofchaos Exp $

/**
 * @file views-view-fields.tpl.php
 * Default simple view template to all the fields as a row.
 *
 * - $view: The view in use.
 * - $fields: an array of $field objects. Each one contains:
 *   - $field->content: The output of the field.
 *   - $field->raw: The raw data for the field, if it exists. This is NOT output safe.
 *   - $field->class: The safe class id to use.
 *   - $field->handler: The Views field handler object controlling this field. Do not use
 *     var_export to dump this object, as it can't handle the recursion.
 *   - $field->inline: Whether or not the field should be inline.
 *   - $field->inline_html: either div or span based on the above flag.
 *   - $field->separator: an optional separator that may appear before a field.
 * - $row: The raw result object from the query, with all data it fetched.
 *
 * @ingroup views_templates
 */
?>

<?php


// Extract the nid of this group
$group_nid = $fields['nid']->raw;

// Remove it from the fields to avoid having it print
unset($fields['nid']);

// Load the view that outputs the group's recent content
if ($group_nid) {
  static $group_content_view;
  if (!$group_content_view) {
    $group_content_view = views_get_view('homepage_group_showcase');
  }
  $display_id = 'block_2';
  $group_content_view
    ->set_display($display_id);
  $group_content_view
    ->set_arguments(array(
    $group_nid,
  ));
  $group_content_view
    ->execute_display($display_id);
  $group_recent_items = $group_content_view
    ->render();
}
?>

<?php

foreach ($fields as $id => $field) {
  ?>
  <?php

  if (!empty($field->separator)) {
    ?>
    <?php

    print $field->separator;
    ?>
  <?php

  }
  ?>

  <<?php

  print $field->inline_html;
  ?> class="views-field-<?php

  print $field->class;
  ?>">
    <?php

  if ($field->label) {
    ?>
      <label class="views-label-<?php

    print $field->class;
    ?>">
        <?php

    print $field->label;
    ?>:
      </label>
    <?php

  }
  ?>
      <?php


  // $field->element_type is either SPAN or DIV depending upon whether or not
  // the field is a 'block' element type or 'inline' element type.
  ?>
      <<?php

  print $field->element_type;
  ?> class="field-content"><?php

  print $field->content;
  ?></<?php

  print $field->element_type;
  ?>>
  </<?php

  print $field->inline_html;
  ?>>
<?php

}
?>

<?php

if ($group_recent_items) {
  print $group_recent_items;
}