You are here

public function FieldCollectionViewsHandlerFieldHostEntityId::render in Field Collection Views 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/views/field/FieldCollectionViewsHandlerFieldHostEntityId.php \Drupal\field_collection_views\Plugin\views\field\FieldCollectionViewsHandlerFieldHostEntityId::render()

Renders the field.

Parameters

\Drupal\views\ResultRow $values: The values retrieved from a single row of a view's query result.

Return value

string|\Drupal\Component\Render\MarkupInterface The rendered output. If the output is safe it will be wrapped in an object that implements MarkupInterface. If it is empty or unsafe it will be a string.

Overrides FieldPluginBase::render

File

src/Plugin/views/field/FieldCollectionViewsHandlerFieldHostEntityId.php, line 47

Class

FieldCollectionViewsHandlerFieldHostEntityId
Field handler to flag the field_collection_views_host_id.

Namespace

Drupal\field_collection_views\Plugin\views\field

Code

public function render(ResultRow $values) {
  $host_entity_id = 0;
  $item_id = $values->item_id;
  $field_collection_item = FieldCollectionItem::load($item_id);
  $host_entity_id = $field_collection_item
    ->getHostId();
  return $host_entity_id;
}