You are here

public function GeolocationStyleBase::getLabelField in Geolocation Field 8.3

Get label value if present.

Parameters

\Drupal\views\ResultRow $row: Result Row.

Return value

string|null Label.

1 call to GeolocationStyleBase::getLabelField()
GeolocationStyleBase::getLocationsFromRow in src/Plugin/views/style/GeolocationStyleBase.php
Render array from views result row.

File

src/Plugin/views/style/GeolocationStyleBase.php, line 389

Class

GeolocationStyleBase
Geolocation Style Base.

Namespace

Drupal\geolocation\Plugin\views\style

Code

public function getLabelField(ResultRow $row) : ?string {
  if (!empty($this->options['label_field']) && $this->options['label_field'] != 'none') {
    $label_field = $this->options['label_field'];
    if (!empty($this->rendered_fields[$row->index][$label_field])) {
      return PlainTextOutput::renderFromHtml($this->rendered_fields[$row->index][$label_field]);
    }
    elseif (!empty($this->view->field[$label_field])) {
      return PlainTextOutput::renderFromHtml($this->view->field[$label_field]
        ->render($row));
    }
  }
  return NULL;
}