You are here

protected function FieldBlock::thirdPartySettingsForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Plugin/Block/FieldBlock.php \Drupal\layout_builder\Plugin\Block\FieldBlock::thirdPartySettingsForm()

Adds the formatter third party settings forms.

Parameters

\Drupal\Core\Field\FormatterInterface $plugin: The formatter.

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.

array $form: The (entire) configuration form array.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

Return value

array The formatter third party settings form.

1 call to FieldBlock::thirdPartySettingsForm()
FieldBlock::formatterSettingsProcessCallback in core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
Render API callback: builds the formatter settings elements.

File

core/modules/layout_builder/src/Plugin/Block/FieldBlock.php, line 310

Class

FieldBlock
Provides a block that renders a field from an entity.

Namespace

Drupal\layout_builder\Plugin\Block

Code

protected function thirdPartySettingsForm(FormatterInterface $plugin, FieldDefinitionInterface $field_definition, array $form, FormStateInterface $form_state) {
  $settings_form = [];

  // Invoke hook_field_formatter_third_party_settings_form(), keying resulting
  // subforms by module name.
  foreach ($this->moduleHandler
    ->getImplementations('field_formatter_third_party_settings_form') as $module) {
    $settings_form[$module] = $this->moduleHandler
      ->invoke($module, 'field_formatter_third_party_settings_form', [
      $plugin,
      $field_definition,
      EntityDisplayBase::CUSTOM_MODE,
      $form,
      $form_state,
    ]);
  }
  return $settings_form;
}