render_cache_hijack_views_handler_field_field.inc in Render cache 7
File
modules/render_cache_views/views/plugins/render_cache_hijack_views_handler_field_field.inc
View source
<?php
class render_cache_hijack_views_handler_field_field extends views_handler_field_field {
function set_items($values, $row_id) {
if (empty($values->_field_data[$this->field_alias]) || empty($values->_field_data[$this->field_alias]['entity']) || !isset($values->_field_data[$this->field_alias]['entity']->{$this->definition['field_name']})) {
return array();
}
$display = array(
'type' => $this->options['type'],
'settings' => $this->options['settings'],
'label' => 'hidden',
'views_view' => $this->view,
'views_field' => $this,
'views_row_id' => $row_id,
);
$entity_type = $values->_field_data[$this->field_alias]['entity_type'];
$entity = $this
->get_value($values, 'entity');
if (!$entity) {
return array();
}
$langcode = $this
->field_language($entity_type, $entity);
$render_array = render_cache_view_field($entity_type, $entity, $this->definition['field_name'], $display, $langcode);
$items = array();
if ($this->options['field_api_classes']) {
$array = $render_array;
return array(
array(
'rendered' => drupal_render($render_array),
),
);
}
foreach (element_children($render_array) as $count) {
$items[$count]['rendered'] = $render_array[$count];
if (isset($render_array['#access'])) {
$items[$count]['rendered']['#access'] = $render_array['#access'];
}
if ((!isset($items[$count]['rendered']['#access']) || $items[$count]['rendered']['#access']) && !empty($render_array['#items'][$count])) {
$items[$count]['raw'] = $render_array['#items'][$count];
}
}
return $items;
}
}