You are here

public function MobileNumber::formatText in Mobile Number 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/WebformElement/MobileNumber.php \Drupal\mobile_number\Plugin\WebformElement\MobileNumber::formatText()

Format an element's value as plain text.

Parameters

array $element: An element.

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

array $options: An array of options.

Return value

array|string The element's value formatted as plain text or a render array.

Overrides WebformElementBase::formatText

File

src/Plugin/WebformElement/MobileNumber.php, line 202

Class

MobileNumber
Provides a 'mobile_number' element.

Namespace

Drupal\mobile_number\Plugin\WebformElement

Code

public function formatText(array $element, WebformSubmissionInterface $webform_submission, array $options = []) {
  $data = $webform_submission
    ->getData($element['#webform_key']);
  return !empty($data['value']) ? $webform_submission
    ->getData($element['#webform_key'])['value'] : '';
}