You are here

public function BatUnitHandlerUnitBundleField::render in Booking and Availability Management Tools for Drupal 8

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

modules/bat_unit/src/Plugin/views/field/BatUnitHandlerUnitBundleField.php, line 19
Contains a Views field handler to take care of displaying the correct label for unit bundles.

Class

BatUnitHandlerUnitBundleField
Plugin annotation @ViewsField("bat_unit_handler_unit_bundle_field");

Namespace

Drupal\bat_unit\Plugin\views\field

Code

public function render(ResultRow $values) {
  $unit_bundle = bat_unit_bundle_load($this
    ->getEntity($values)
    ->bundle());
  return $unit_bundle
    ->label();
}