You are here

public function BundleConfigManager::setTitleFieldFormatter in Title 8.2

Set the field formatter for a

Parameters

string $bundle: The bundle settings will be updated on.

string $view_mode: The view mode to change the field formatter on.

string $formatter: The formatter to change to.

array $settings: The settings for that formatter.

2 calls to BundleConfigManager::setTitleFieldFormatter()
BundleConfigManager::setupBundleState in src/BundleConfigManager.php
Setup the state for a new bundle to match the rendering of core.
BundleConfigManager::tearDownBundleState in src/BundleConfigManager.php
Hide the title on all view modes when of a bundle when disabling.

File

src/BundleConfigManager.php, line 87

Class

BundleConfigManager
Allow management of the title module config.

Namespace

Drupal\title

Code

public function setTitleFieldFormatter($bundle, $view_mode, $formatter, $settings) {
  $display = $this
    ->loadDisplay($bundle, $view_mode);
  if (!$display) {
    return;
  }
  $display
    ->setComponent('title', [
    'type' => $formatter,
    'settings' => $settings,
    'weight' => -5,
  ]);
  $display
    ->save();
}