Skip to content

NodeField

Provides a block that renders a node field.


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

Properties

entityFieldManager

The entity field manager.

protected \Drupal\Core\Entity\EntityFieldManagerInterface $entityFieldManager

entityTypeBundleInfo

The entity type bundle info service.

protected \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entityTypeBundleInfo

entityTypeManager

The entity type manager.

protected \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager

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

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

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

getField

Gets the field item.

protected getField(): \Drupal\Core\Field\FieldItemListInterface|null

Return Value:

The field item list if an entity is available or NULL otherwise.


getFieldDisplay

Get the field display array.

protected getFieldDisplay(): array

Return Value:

The field display.

See Also:

  • \Drupal\Core\Entity\EntityViewBuilderInterface::viewField

calculateDependencies

{@inheritdoc}

public calculateDependencies(): mixed