Commit 2ad52dcc authored by Dan Flanagan's avatar Dan Flanagan
Browse files

Issue #3302083 by danflanagan8: Replace StyleEntityReferenceItem with the core EntityReferenceItem

parent f28239d4
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -26,6 +26,3 @@ field.storage_settings.style_entity_reference:

field.field_settings.style_entity_reference:
  type: field.field_settings.entity_reference

field.formatter.settings.style_entity_reference_label:
  type: field.formatter.settings.entity_reference_label
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ use Drupal\Core\Config\Entity\ConfigEntityInterface;
 *     "label" = "label",
 *     "uuid" = "uuid"
 *   },
 *   common_reference_target = TRUE,
 *   links = {
 *     "canonical" = "/admin/structure/styles/{styles}",
 *     "add-form" = "/admin/structure/styles/add",
+0 −29
Original line number Diff line number Diff line
<?php

namespace Drupal\style_entity\Plugin\Field\FieldFormatter;

use Drupal\Core\Entity\EntityDisplayRepositoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceLabelFormatter;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter;

/**
 * Plugin implementation of the 'entity reference rendered entity' formatter.
 *
 * @FieldFormatter(
 *   id = "style_entity_reference_label",
 *   label = @Translation("Label"),
 *   description = @Translation("Display the label of the referenced entities."),
 *   field_types = {
 *     "style_entity_reference"
 *   }
 * )
 */
class StyleEntityReferenceFormatter extends EntityReferenceLabelFormatter {

}
+8 −694

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ function style_entity_get_styles($entity, &$variables) {
  foreach ($fields as $delta => $field) {
    if ($field instanceof FieldConfig) {
      /** @var Drupal\field\Entity\FieldConfig $field */
      if ($field->getType() == 'style_entity_reference') {
      if ($field->getType() == 'entity_reference' && $field->getFieldStorageDefinition()->getSetting('target_type') === 'styles') {
        $style_field = $delta;
      }
    }
Loading