public function WebformEntityController::title in Webform 8.5
Same name and namespace in other branches
- 6.x src/Controller/WebformEntityController.php \Drupal\webform\Controller\WebformEntityController::title()
Route title callback.
Parameters
\Drupal\webform\WebformInterface|null $webform: A webform.
Return value
string The webform label as a render array.
8 string references to 'WebformEntityController::title'
- webform.routing.yml in ./
webform.routing.yml - webform.routing.yml
- webform_devel.routing.yml in modules/
webform_devel/ webform_devel.routing.yml - modules/webform_devel/webform_devel.routing.yml
- webform_node.routing.yml in modules/
webform_node/ webform_node.routing.yml - modules/webform_node/webform_node.routing.yml
- webform_options_limit.routing.yml in modules/
webform_options_limit/ webform_options_limit.routing.yml - modules/webform_options_limit/webform_options_limit.routing.yml
- webform_share.routing.yml in modules/
webform_share/ webform_share.routing.yml - modules/webform_share/webform_share.routing.yml
File
- src/
Controller/ WebformEntityController.php, line 356
Class
- WebformEntityController
- Provides route responses for Webform entity.
Namespace
Drupal\webform\ControllerCode
public function title(WebformInterface $webform = NULL) {
/** @var \Drupal\Core\Entity\EntityInterface $source_entity */
if (!$webform) {
list($webform, $source_entity) = $this->requestHandler
->getWebformEntities();
}
else {
$source_entity = $this->requestHandler
->getCurrentSourceEntity('webform');
}
// If source entity does not exist or does not have a label always use
// the webform's label.
if (!$source_entity || !method_exists($source_entity, 'label')) {
return $webform
->label();
}
// Handler duplicate titles.
if ($source_entity
->label() === $webform
->label()) {
return $webform
->label();
}
// Get the webform's title.
switch ($webform
->getSetting('form_title')) {
case WebformInterface::TITLE_SOURCE_ENTITY:
return $source_entity
->label();
case WebformInterface::TITLE_WEBFORM:
return $webform
->label();
case WebformInterface::TITLE_WEBFORM_SOURCE_ENTITY:
$t_args = [
'@source_entity' => $source_entity
->label(),
'@webform' => $webform
->label(),
];
return $this
->t('@webform: @source_entity', $t_args);
case WebformInterface::TITLE_SOURCE_ENTITY_WEBFORM:
default:
$t_args = [
'@source_entity' => $source_entity
->label(),
'@webform' => $webform
->label(),
];
return $this
->t('@source_entity: @webform', $t_args);
}
}