TextLongItem.php 938 Bytes
Newer Older
1 2
<?php

3
namespace Drupal\text\Plugin\Field\FieldType;
4

5
use Drupal\Core\Field\FieldStorageDefinitionInterface;
6 7 8 9 10 11

/**
 * Plugin implementation of the 'text_long' field type.
 *
 * @FieldType(
 *   id = "text_long",
12 13
 *   label = @Translation("Text (formatted, long)"),
 *   description = @Translation("This field stores a long text with a text format."),
14
 *   category = @Translation("Text"),
15 16 17 18 19 20 21 22 23
 *   default_widget = "text_textarea",
 *   default_formatter = "text_default"
 * )
 */
class TextLongItem extends TextItemBase {

  /**
   * {@inheritdoc}
   */
24
  public static function schema(FieldStorageDefinitionInterface $field_definition) {
25 26 27
    return [
      'columns' => [
        'value' => [
28 29
          'type' => 'text',
          'size' => 'big',
30 31
        ],
        'format' => [
32
          'type' => 'varchar_ascii',
33
          'length' => 255,
34 35 36 37 38 39
        ],
      ],
      'indexes' => [
        'format' => ['format'],
      ],
    ];
40 41 42
  }

}