function FieldLabelOptionsTrait::getFieldLabelOptions

Same name in other branches
  1. 11.x core/modules/field/src/FieldLabelOptionsTrait.php \Drupal\field\FieldLabelOptionsTrait::getFieldLabelOptions()

Returns an array of visibility options for field labels.

Return value

array An array of visibility options.

2 calls to FieldLabelOptionsTrait::getFieldLabelOptions()
EntityViewDisplayEditForm::buildFieldRow in core/modules/field_ui/src/Form/EntityViewDisplayEditForm.php
Builds the table row structure for a single field.
FieldBlock::blockForm in core/modules/layout_builder/src/Plugin/Block/FieldBlock.php

File

core/modules/field/src/FieldLabelOptionsTrait.php, line 16

Class

FieldLabelOptionsTrait
Provides a trait for the valid field label options.

Namespace

Drupal\field

Code

protected function getFieldLabelOptions() : array {
    return [
        'above' => $this->t('Above'),
        'inline' => $this->t('Inline'),
        'hidden' => '- ' . $this->t('Hidden') . ' -',
        'visually_hidden' => '- ' . $this->t('Visually Hidden') . ' -',
    ];
}

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