You are here

public function EntityLegalDocument::getAcceptanceLabel in Entity Legal 8.2

Same name and namespace in other branches
  1. 4.0.x src/Entity/EntityLegalDocument.php \Drupal\entity_legal\Entity\EntityLegalDocument::getAcceptanceLabel()
  2. 3.0.x src/Entity/EntityLegalDocument.php \Drupal\entity_legal\Entity\EntityLegalDocument::getAcceptanceLabel()

Get the label to be shown on the acceptance checkbox.

Return value

string The label to be shown on the acceptance checkbox.

Overrides EntityLegalDocumentInterface::getAcceptanceLabel

File

src/Entity/EntityLegalDocument.php, line 193

Class

EntityLegalDocument
Defines the entity legal document entity.

Namespace

Drupal\entity_legal\Entity

Code

public function getAcceptanceLabel() {
  $label = '';
  $published_version = $this
    ->getPublishedVersion();
  if ($published_version) {
    $label = $published_version
      ->get('acceptance_label')->value;
  }
  $token_service = \Drupal::service('token');
  $label = $token_service
    ->replace($label, [
    ENTITY_LEGAL_DOCUMENT_ENTITY_NAME => $this,
  ]);
  return Xss::filter($label);
}