Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FieldLabelOptionsTrait.php

trait FieldLabelOptionsTrait

Provides a trait for the valid field label options.

Hierarchy

  • trait \Drupal\field\FieldLabelOptionsTrait
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.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal