You are here

public function WebformElementBase::hasValue in Webform 6.x

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

Determine if an element's has a submission value.

Parameters

array $element: An element.

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

array $options: An array of options.

Return value

bool TRUE if them element's has a submission value.

Overrides WebformElementInterface::hasValue

5 calls to WebformElementBase::hasValue()
WebformCompositeBase::formatHtmlItem in src/Plugin/WebformElement/WebformCompositeBase.php
Format an element's value as HTML.
WebformCompositeBase::formatTextItem in src/Plugin/WebformElement/WebformCompositeBase.php
Format an element's value as text.
WebformElementBase::format in src/Plugin/WebformElementBase.php
Format an element's value as HTML or plain text.
WebformHeight::hasValue in src/Plugin/WebformElement/WebformHeight.php
Determine if an element's has a submission value.
WebformMapping::formatTextItem in src/Plugin/WebformElement/WebformMapping.php
Format an element's value as text.
2 methods override WebformElementBase::hasValue()
WebformAttachmentBase::hasValue in modules/webform_attachment/src/Plugin/WebformElement/WebformAttachmentBase.php
Determine if an element's has a submission value.
WebformHeight::hasValue in src/Plugin/WebformElement/WebformHeight.php
Determine if an element's has a submission value.

File

src/Plugin/WebformElementBase.php, line 1685

Class

WebformElementBase
Provides a base class for a webform element.

Namespace

Drupal\webform\Plugin

Code

public function hasValue(array $element, WebformSubmissionInterface $webform_submission, array $options = []) {
  $value = $this
    ->getValue($element, $webform_submission, $options);
  return $value === '' || $value === NULL || is_array($value) && empty($value) ? FALSE : TRUE;
}