You are here

public function FieldPluginBase::elementWrapperType in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::elementWrapperType()

Returns an HTML element for the wrapper based upon the field's element type.

Parameters

bool $none_supported: Whether or not this HTML element is supported.

bool $default_empty: Whether or not this HTML element is empty by default.

Overrides FieldHandlerInterface::elementWrapperType

File

core/modules/views/src/Plugin/views/field/FieldPluginBase.php, line 294

Class

FieldPluginBase
Base class for views fields.

Namespace

Drupal\views\Plugin\views\field

Code

public function elementWrapperType($none_supported = FALSE, $default_empty = FALSE) {
  if ($none_supported) {
    if ($this->options['element_wrapper_type'] === '0') {
      return 0;
    }
  }
  if ($this->options['element_wrapper_type']) {
    return $this->options['element_wrapper_type'];
  }
  if ($default_empty) {
    return '';
  }
  return 'div';
}