You are here

protected static function Dimension::_schema in Dimension 2.1.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldType/Dimension.php \Drupal\dimension\Plugin\Field\FieldType\Dimension::_schema()
  2. 2.0.x src/Plugin/Field/FieldType/Dimension.php \Drupal\dimension\Plugin\Field\FieldType\Dimension::_schema()

Parameters

\Drupal\Core\Field\FieldStorageDefinitionInterface $field_definition:

$fields:

Return value

\array[][]

3 calls to Dimension::_schema()
Area::schema in src/Plugin/Field/FieldType/Area.php
Returns the schema for the field.
Length::schema in src/Plugin/Field/FieldType/Length.php
Returns the schema for the field.
Volume::schema in src/Plugin/Field/FieldType/Volume.php
Returns the schema for the field.

File

src/Plugin/Field/FieldType/Dimension.php, line 82

Class

Dimension

Namespace

Drupal\dimension\Plugin\Field\FieldType

Code

protected static function _schema(FieldStorageDefinitionInterface $field_definition, $fields) : array {
  $settings = $field_definition
    ->getSettings();
  $schema = [
    'columns' => [
      'value' => [
        'type' => 'numeric',
        'precision' => $settings['value_precision'],
        'scale' => $settings['value_scale'],
      ],
    ],
  ];
  foreach ($fields as $key => $label) {
    $schema['columns'][$key] = [
      'type' => 'numeric',
      'precision' => $settings[$key . '_precision'],
      'scale' => $settings[$key . '_scale'],
    ];
  }
  return $schema;
}