You are here

public function WebformSubmission::label in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Entity/WebformSubmission.php \Drupal\webform\Entity\WebformSubmission::label()

Gets the label of the entity.

Return value

string|null The label of the entity, or NULL if there is no label defined.

Overrides ContentEntityBase::label

File

src/Entity/WebformSubmission.php, line 247

Class

WebformSubmission
Defines the WebformSubmission entity.

Namespace

Drupal\webform\Entity

Code

public function label() {
  $submission_label = $this
    ->getWebform()
    ->getSetting('submission_label') ?: \Drupal::config('webform.settings')
    ->get('settings.default_submission_label');

  /** @var \Drupal\webform\WebformTokenManagerInterface $token_manager */
  $token_manager = \Drupal::service('webform.token_manager');
  return PlainTextOutput::renderFromHtml($token_manager
    ->replaceNoRenderContext($submission_label, $this));
}