You are here

protected function Xls::getViewFieldLabel in Excel Serialization 8

Get the label in the view for a field name (if available)

Parameters

\Drupal\views\ViewExecutable $view: The view to get the field labels from.

string $field_name: The field name to get the view label for.

Return value

string The label in the view if available, field name otherwise.

1 call to Xls::getViewFieldLabel()
Xls::encode in src/Encoder/Xls.php
Encodes data into the given format.

File

src/Encoder/Xls.php, line 468

Class

Xls
Adds XLS encoder support for the Serialization API.

Namespace

Drupal\xls_serialization\Encoder

Code

protected function getViewFieldLabel(ViewExecutable $view, $field_name) {
  return isset($view->field[$field_name]->options['label']) ? $view->field[$field_name]->options['label'] : $field_name;
}