function FieldPluginBase::getElements

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

Provides a list of elements valid for field HTML.

This function can be overridden by fields that want more or fewer elements available, though this seems like it would be an incredibly rare occurrence.

Overrides FieldHandlerInterface::getElements

1 call to FieldPluginBase::getElements()
FieldPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/field/FieldPluginBase.php
Default option form that provides label widget that all fields should have.

File

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

Class

FieldPluginBase
Base class for views fields.

Namespace

Drupal\views\Plugin\views\field

Code

public function getElements() {
    static $elements = NULL;
    if (!isset($elements)) {
        // @todo Add possible html5 elements.
        $elements = [
            '' => $this->t('- Use default -'),
            '0' => $this->t('- None -'),
        ];
        $elements += \Drupal::config('views.settings')->get('field_rewrite_elements');
    }
    return $elements;
}

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