function FieldBlock::thirdPartySettingsForm

Same name in other branches
  1. 8.9.x core/modules/layout_builder/src/Plugin/Block/FieldBlock.php \Drupal\layout_builder\Plugin\Block\FieldBlock::thirdPartySettingsForm()
  2. 10 core/modules/layout_builder/src/Plugin/Block/FieldBlock.php \Drupal\layout_builder\Plugin\Block\FieldBlock::thirdPartySettingsForm()
  3. 11.x 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 316

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.
    $this->moduleHandler
        ->invokeAllWith('field_formatter_third_party_settings_form', function (callable $hook, string $module) use (&$settings_form, $plugin, $field_definition, $form, $form_state) {
        $settings_form[$module] = $hook($plugin, $field_definition, EntityDisplayBase::CUSTOM_MODE, $form, $form_state);
    });
    return $settings_form;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.