public static function WebformComputedBase::getMode in Webform 6.x
Same name in this branch
- 6.x src/Element/WebformComputedBase.php \Drupal\webform\Element\WebformComputedBase::getMode()
- 6.x src/Plugin/WebformElement/WebformComputedBase.php \Drupal\webform\Plugin\WebformElement\WebformComputedBase::getMode()
Same name and namespace in other branches
- 8.5 src/Element/WebformComputedBase.php \Drupal\webform\Element\WebformComputedBase::getMode()
Get an element's value mode/type.
Parameters
array $element: The element.
Return value
string The markup type (html or text).
2 calls to WebformComputedBase::getMode()
- WebformComputedToken::computeValue in src/
Element/ WebformComputedToken.php - Compute value.
- WebformComputedTwig::computeValue in src/
Element/ WebformComputedTwig.php - Compute value.
File
- src/
Element/ WebformComputedBase.php, line 311
Class
- WebformComputedBase
- Provides a base class for 'webform_computed' elements.
Namespace
Drupal\webform\ElementCode
public static function getMode(array $element) {
if (empty($element['#mode']) || $element['#mode'] === WebformComputedInterface::MODE_AUTO) {
return WebformHtmlHelper::containsHtml($element['#template']) ? WebformComputedInterface::MODE_HTML : WebformComputedInterface::MODE_TEXT;
}
else {
return $element['#mode'];
}
}