You are here

public function EntityFieldRenderer::compatibleWithField in Search API 8

Determines whether this renderer can handle the given field.

Parameters

\Drupal\views\Plugin\views\field\FieldHandlerInterface $field: The field for which to check compatibility.

Return value

bool TRUE if this renderer can handle the given field, FALSE otherwise.

See also

EntityFieldRenderer::getRenderableFieldIds()

1 call to EntityFieldRenderer::compatibleWithField()
EntityFieldRenderer::getRenderableFieldIds in src/Plugin/views/EntityFieldRenderer.php
Returns a list of names of entity fields to be rendered.

File

src/Plugin/views/EntityFieldRenderer.php, line 92

Class

EntityFieldRenderer
Renders entity fields.

Namespace

Drupal\search_api\Plugin\views

Code

public function compatibleWithField(FieldHandlerInterface $field) {
  if ($field instanceof SearchApiEntityField && $field->options['field_rendering'] && $field->relationship === $this->relationship && $field
    ->getDatasourceId() === $this->datasourceId && $field
    ->getParentPath() === $this->parentPath && ($field->definition['entity_type'] ?? '') === $this
    ->getEntityTypeId()) {
    return TRUE;
  }
  return FALSE;
}