You are here

protected function FarmFieldFactory::modifyTextField in farmOS 2.x

Text field modifier.

Parameters

\Drupal\Core\Field\BaseFieldDefinition &$field: A base field definition object.

array $options: An array of options.

1 call to FarmFieldFactory::modifyTextField()
FarmFieldFactory::buildFieldDefinition in modules/core/field/src/FarmFieldFactory.php
Builds a field definition with farmOS opinions.

File

modules/core/field/src/FarmFieldFactory.php, line 791

Class

FarmFieldFactory
Factory for generating farmOS field definitions.

Namespace

Drupal\farm_field

Code

protected function modifyTextField(BaseFieldDefinition &$field, array $options = []) {

  // Build form and view display settings.
  $field
    ->setDisplayOptions('form', [
    'type' => 'text_textarea',
    'settings' => [
      'rows' => '5',
      'placeholder' => '',
    ],
    'weight' => $options['weight']['form'] ?? 0,
  ]);
  $field
    ->setDisplayOptions('view', [
    'label' => 'inline',
    'type' => 'text_default',
    'weight' => $options['weight']['view'] ?? 0,
  ]);
}