You are here

protected function Checkbox::build in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/Checkbox.php \Drupal\webform\Plugin\WebformElement\Checkbox::build()

Build an element as text or HTML.

Parameters

string $format: Format of the element, text or html.

array $element: An element.

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

array $options: An array of options.

Return value

array A render array representing an element as text or HTML.

Overrides WebformElementBase::build

File

src/Plugin/WebformElement/Checkbox.php, line 47

Class

Checkbox
Provides a 'checkbox' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

protected function build($format, array &$element, WebformSubmissionInterface $webform_submission, array $options = []) {
  if ($this
    ->isEmptyExcluded($element, $options) && !$this
    ->getValue($element, $webform_submission, $options)) {
    return NULL;
  }
  else {
    return parent::build($format, $element, $webform_submission, $options);
  }
}