You are here

private function Dimension::_storageSettings 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::_storageSettings()
  2. 2.0.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 110

Class

Dimension

Namespace

Drupal\dimension\Plugin\Field\FieldType

Code

private function _storageSettings(&$element, $key, $label, $has_data, $settings) {
  $element[$key] = array(
    '#type' => 'fieldset',
    '#title' => $label,
  );
  $range = range(10, 32);
  $element[$key]['precision'] = array(
    '#type' => 'select',
    '#title' => $this
      ->t('Precision'),
    '#options' => array_combine($range, $range),
    '#default_value' => $settings['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'] = array(
    '#type' => 'select',
    '#title' => $this
      ->t('Scale', array(), array(
      'decimal places',
    )),
    '#options' => array_combine($range, $range),
    '#default_value' => $settings['scale'],
    '#description' => $this
      ->t('The number of digits to the right of the decimal.'),
    '#disabled' => $has_data,
  );
}