Loading src/Plugin/Field/FieldFormatter/EntityReferenceFacetFormatterBase.php +9 −6 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. Loading @@ -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.'), Loading Loading
src/Plugin/Field/FieldFormatter/EntityReferenceFacetFormatterBase.php +9 −6 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. Loading @@ -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.'), Loading