trait FieldLabelOptionsTrait

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

Provides a trait for the valid field label options.

Hierarchy

2 files declare their use of FieldLabelOptionsTrait
EntityViewDisplayEditForm.php in core/modules/field_ui/src/Form/EntityViewDisplayEditForm.php
FieldBlock.php in core/modules/layout_builder/src/Plugin/Block/FieldBlock.php

File

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

Namespace

Drupal\field
View source
trait FieldLabelOptionsTrait {
    
    /**
     * Returns an array of visibility options for field labels.
     *
     * @return array
     *   An array of visibility options.
     */
    protected function getFieldLabelOptions() : array {
        return [
            'above' => $this->t('Above'),
            'inline' => $this->t('Inline'),
            'hidden' => '- ' . $this->t('Hidden') . ' -',
            'visually_hidden' => '- ' . $this->t('Visually Hidden') . ' -',
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary
FieldLabelOptionsTrait::getFieldLabelOptions protected function Returns an array of visibility options for field labels.

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