You are here

protected static function Dimension::_schema in Dimension 8

Same name and namespace in other branches
  1. 2.1.x 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()
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 87

Class

Dimension

Namespace

Drupal\dimension\Plugin\Field\FieldType

Code

protected static function _schema(FieldStorageDefinitionInterface $field_definition, $fields) {
  $settings = $field_definition
    ->getSetting('storage_value');
  $schema = array(
    'columns' => array(
      'value' => array(
        'type' => 'numeric',
        'precision' => $settings['precision'],
        'scale' => $settings['scale'],
      ),
    ),
  );
  foreach ($fields as $key => $label) {
    $settings = $field_definition
      ->getSetting('storage_' . $key);
    $schema['columns'][$key] = array(
      'type' => 'numeric',
      'precision' => $settings['precision'],
      'scale' => $settings['scale'],
    );
  }
  return $schema;
}