Skip to content

ContextEntity

Provides a block that renders the current entity.


  • Full name: \Drupal\helper\Plugin\Block\ContextEntity
  • Parent class: BlockBase
  • This class implements: ContainerFactoryPluginInterface

Properties

entityTypeManager

The entity type manager.

protected \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager

entityDisplayRepository

The entity display repository.

protected \Drupal\Core\Entity\EntityDisplayRepositoryInterface $entityDisplayRepository

currentEntityHelper

The current entity helper.

protected \Drupal\helper\CurrentEntity $currentEntityHelper

Methods

create

{@inheritdoc}

public static create(\Symfony\Component\DependencyInjection\ContainerInterface $container, array $configuration, mixed $plugin_id, mixed $plugin_definition): mixed
  • This method is static. Parameters:
Parameter Type Description
$container \Symfony\Component\DependencyInjection\ContainerInterface
$configuration array
$plugin_id mixed
$plugin_definition mixed

defaultConfiguration

{@inheritdoc}

public defaultConfiguration(): mixed

buildConfigurationForm

{@inheritdoc}

public buildConfigurationForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state): mixed

Parameters:

Parameter Type Description
$form array
$form_state \Drupal\Core\Form\FormStateInterface

blockForm

{@inheritdoc}

public blockForm(mixed $form, \Drupal\Core\Form\FormStateInterface $form_state): array

Parameters:

Parameter Type Description
$form mixed
$form_state \Drupal\Core\Form\FormStateInterface

updateViewModesCallback

AJAX callback: Update view mode select when entity context is changed.

public updateViewModesCallback(array& $form, \Drupal\Core\Form\FormStateInterface $form_state): array

Parameters:

Parameter Type Description
$form array
$form_state \Drupal\Core\Form\FormStateInterface

blockSubmit

{@inheritdoc}

public blockSubmit(mixed $form, \Drupal\Core\Form\FormStateInterface $form_state): mixed

Parameters:

Parameter Type Description
$form mixed
$form_state \Drupal\Core\Form\FormStateInterface

build

{@inheritdoc}

public build(): mixed