You are here

public function FieldPluginBase::elementType 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::elementType()

Returns an HTML element 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.

bool $inline: Whether or not this HTML element is inline.

Overrides FieldHandlerInterface::elementType

1 method overrides FieldPluginBase::elementType()
Markup::elementType in core/modules/views/src/Plugin/views/field/Markup.php
Returns an HTML element based upon the field's element type.

File

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

Class

FieldPluginBase
Base class for views fields.

Namespace

Drupal\views\Plugin\views\field

Code

public function elementType($none_supported = FALSE, $default_empty = FALSE, $inline = FALSE) {
  if ($none_supported) {
    if ($this->options['element_type'] === '0') {
      return '';
    }
  }
  if ($this->options['element_type']) {
    return $this->options['element_type'];
  }
  if ($default_empty) {
    return '';
  }
  if ($inline) {
    return 'span';
  }
  if (isset($this->definition['element type'])) {
    return $this->definition['element type'];
  }
  return 'span';
}