FieldLabelOptionsTrait.php

Same filename in other branches
  1. 11.x core/modules/field/src/FieldLabelOptionsTrait.php

Namespace

Drupal\field

File

core/modules/field/src/FieldLabelOptionsTrait.php

View source
<?php

namespace Drupal\field;


/**
 * Provides a trait for the valid field label options.
 */
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') . ' -',
        ];
    }

}

Traits

Title Deprecated Summary
FieldLabelOptionsTrait Provides a trait for the valid field label options.

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