You are here

public static function WebformSubmissionController::buildSticky in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Controller/WebformSubmissionController.php \Drupal\webform\Controller\WebformSubmissionController::buildSticky()

Build sticky icon.

Parameters

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

Return value

\Drupal\Component\Render\FormattableMarkup Sticky icon.

2 calls to WebformSubmissionController::buildSticky()
WebformSubmissionController::sticky in src/Controller/WebformSubmissionController.php
Toggle webform submission sticky.
WebformSubmissionListBuilder::buildRowColumn in src/WebformSubmissionListBuilder.php
Build row column.

File

src/Controller/WebformSubmissionController.php, line 137

Class

WebformSubmissionController
Provides route responses for Webform submissions.

Namespace

Drupal\webform\Controller

Code

public static function buildSticky(WebformSubmissionInterface $webform_submission) {
  $t_args = [
    '@label' => $webform_submission
      ->label(),
  ];
  $args = [
    '@state' => $webform_submission
      ->isSticky() ? 'on' : 'off',
    '@label' => $webform_submission
      ->isSticky() ? t('Unstar/Unflag @label', $t_args) : t('Star/flag @label', $t_args),
  ];
  return new FormattableMarkup('<span class="webform-icon webform-icon-sticky webform-icon-sticky--@state"></span><span class="visually-hidden">@label</span>', $args);
}