public function FlexiformController::formModePageTitle in Flexiform 8
Flexiform form mode title callback.
File
- src/
Controller/ FlexiformController.php, line 93
Class
- FlexiformController
- Controller for flexiform pages.
Namespace
Drupal\flexiform\ControllerCode
public function formModePageTitle(EntityFormMode $form_mode, Request $request) {
$settings = $form_mode
->getThirdPartySetting('flexiform', 'exposure');
$entities = $this
->getProvidedEntities($form_mode, $request);
// @todo: Move this process somewhere better.
$token_data = $token_options = [];
$token_info = $this->token
->getInfo();
foreach ($entities as $namespace => $entity) {
$token_type = $entity
->getEntityType()
->get('token_type') ?: (!empty($token_info['types'][$entity
->getEntityTypeId()]) ? $entity
->getEntityTypeId() : FALSE);
if ($token_type) {
$token_data[$namespace] = $entity;
$token_options['alias'][$namespace] = $token_type;
}
}
return $this->token
->replace($settings['title'], $token_data, $token_options);
}