function FieldPluginBase::elementType

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::elementType()
  2. 10 core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::elementType()
  3. 11.x core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::elementType()

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';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.