You are here

private function Dimension::_storageSettings in Dimension 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldType/Dimension.php \Drupal\dimension\Plugin\Field\FieldType\Dimension::_storageSettings()
  2. 2.1.x src/Plugin/Field/FieldType/Dimension.php \Drupal\dimension\Plugin\Field\FieldType\Dimension::_storageSettings()
1 call to Dimension::_storageSettings()
Dimension::storageSettingsForm in src/Plugin/Field/FieldType/Dimension.php
Returns a form for the storage-level settings.

File

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

Class

Dimension

Namespace

Drupal\dimension\Plugin\Field\FieldType

Code

private function _storageSettings(&$element, $key, $label, $has_data, $settings) : void {
  $range = range(10, 32);
  $element[$key . '_precision'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('%label precision', [
      '%label' => $label,
    ]),
    '#options' => array_combine($range, $range),
    '#default_value' => $settings[$key . '_precision'],
    '#description' => $this
      ->t('The total number of digits to store in the database, including those to the right of the decimal.'),
    '#disabled' => $has_data,
  ];
  $range = range(0, 10);
  $element[$key . '_scale'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('%label scale', [
      '%label' => $label,
    ]),
    '#options' => array_combine($range, $range),
    '#default_value' => $settings[$key . '_scale'],
    '#description' => $this
      ->t('The number of digits to the right of the decimal.'),
    '#disabled' => $has_data,
  ];
}