/** * {@inheritdoc} */ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { $element = parent::fieldSettingsForm($form, $form_state); $element['min']['#step'] = 'any'; $element['max']['#step'] = 'any'; return $element; }
/** * {@inheritdoc} */ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { $element = parent::fieldSettingsForm($form, $form_state); $settings = $this->getSettings(); $element['min']['#step'] = pow(0.1, $settings['scale']); $element['max']['#step'] = pow(0.1, $settings['scale']); return $element; }
/** * {@inheritdoc} */ public function getConstraints() { $constraints = parent::getConstraints(); // If this is an unsigned integer, add a validation constraint for the // integer to be positive. if ($this->getSetting('unsigned')) { $constraint_manager = \Drupal::typedDataManager()->getValidationConstraintManager(); $constraints[] = $constraint_manager->create('ComplexData', array('value' => array('Range' => array('min' => 0, 'minMessage' => t('%name: The integer must be larger or equal to %min.', array('%name' => $this->getFieldDefinition()->getLabel(), '%min' => 0)))))); } return $constraints; }
/** * {@inheritdoc} */ public static function defaultSettings() { return array('precision' => 10, 'scale' => 2) + parent::defaultSettings(); }