public function BundleConfigManager::setTitleRegion in Title 8.2
Set the region that a title is displayed in for a bundle and view mode.
Parameters
string $bundle: The bundle that will be manipulated.
string $region: The region to move the title field into.
1 call to BundleConfigManager::setTitleRegion()
- BundleConfigManager::tearDownBundleState in src/
BundleConfigManager.php - Hide the title on all view modes when of a bundle when disabling.
File
- src/
BundleConfigManager.php, line 60
Class
- BundleConfigManager
- Allow management of the title module config.
Namespace
Drupal\titleCode
public function setTitleRegion($bundle, $view_mode, $region) {
$display_config = $this
->loadDisplay($bundle, $view_mode);
// Only change the region on display configurations that have been enabled.
if (empty($display_config)) {
return;
}
if ($region === TITLE_DISPLAY_REGION_DISABLED) {
$display_config
->removeComponent('title');
}
elseif ($region === TITLE_DISPLAY_REGION_ENABLED) {
$display_config
->setComponent('title', [
'weight' => -5,
]);
}
$display_config
->save();
}