Same name and namespace in other branches
  1. 8.x-1.x src/Plugin/Field/FieldFormatter/EntityReferenceAjaxFormatter.php \Drupal\entity_reference_ajax_formatter\Plugin\Field\FieldFormatter\EntityReferenceAjaxFormatter::__construct() 1 comment

Constructs a EntityReferenceAjaxFormatter instance.

Parameters

string $plugin_id: The plugin_id for the formatter.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The definition of the field to which the formatter is associated.

mixed[] $settings: The formatter settings.

string $label: The formatter label display setting.

string $view_mode: The view mode.

mixed[] $third_party_settings: Any third party settings settings.

\Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory: The logger factory.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

\Drupal\Core\Entity\EntityDisplayRepositoryInterface $entity_display_repository: The entity display repository.

\Drupal\Core\Routing\CurrentRouteMatch $current_route: The current route.

File

src/Plugin/Field/FieldFormatter/EntityReferenceAjaxFormatter.php, line 68

Class

EntityReferenceAjaxFormatter
Plugin implementation of the 'entity reference rendered entity' formatter.

Namespace

Drupal\entity_reference_ajax_formatter\Plugin\Field\FieldFormatter

Code

public function __construct(string $plugin_id, mixed $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, string $label, string $view_mode, array $third_party_settings, LoggerChannelFactoryInterface $logger_factory, EntityTypeManagerInterface $entity_type_manager, EntityDisplayRepositoryInterface $entity_display_repository, CurrentRouteMatch $current_route) {
    $this->currentRoute = $current_route;
    if ($current_route->getRouteName() === 'entity_reference_ajax_formatter.ajax_field') {
        $label = 'hidden';
    }
    parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings, $logger_factory, $entity_type_manager, $entity_display_repository);
}