Commit e9b0b045 authored by Jonathan DeLaigle's avatar Jonathan DeLaigle Committed by David Cameron
Browse files

Issue #3263663 by grndlvl: Error: Call to undefined method...

Issue #3263663 by grndlvl: Error: Call to undefined method Drupal\search_api\Plugin\search_api\processor\Property\AggregatedFieldProperty::getFieldDefinition()
parent 4c7516f0
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\TypedData\FieldItemDataDefinition;
use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
@@ -110,8 +111,9 @@ abstract class EntityReferenceFacetFormatterBase extends EntityReferenceFormatte
    $facets = $this->facetStorage->loadMultiple();
    $options = [];
    foreach ($facets as $facet) {
      /** @var \Drupal\Core\Field\TypedData\FieldItemDataDefinition $definition */
      $definition = $facet->getDataDefinition($facet->getFieldIdentifier());
      // Ensure that we are only dealing with facets associated with fields.
      if ($definition instanceof FieldItemDataDefinition) {
        $facet_field_name = $definition->getFieldDefinition()->getName();

        // Add a facet to the options only if that facet is faceting this field.
@@ -119,6 +121,7 @@ abstract class EntityReferenceFacetFormatterBase extends EntityReferenceFormatte
          $options[$facet->id()] = $facet->label();
        }
      }
    }

    $elements['facet'] = [
      '#title' => $this->t('Select the facet to which the labels should be linked.'),