You are here

public function FieldPluginBase::getElements in Drupal 9

Same name and namespace in other branches
  1. 8 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 options form that provides the label widget that all fields should have.

File

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

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