/** * {@inheritdoc} * * */ public function submitForm(array &$form, FormStateInterface $form_state) { $c = new Conversion(); $val = $form_state->getValue('length'); $from = $form_state->getValue('unit'); $to = $form_state->getValue('units'); print_r('input'); print_r($val); //$result = $c->assign($from,$val); drupal_set_message($this->t('Your result is @length @unit', array('@length' => $c->convertlength($from, $val, $to), '@unit' => $form_state->getValue('units')))); }
/** * {@inheritdoc} * * */ public function submitForm(array &$form, FormStateInterface $form_state) { $d = new Conversion(); $value = $form_state->getValue('weight'); $frome = $form_state->getValue('mass'); $too = $form_state->getValue('masses'); print_r('input'); print_r($value); //$result = $d->assign($from,$val); drupal_set_message($this->t('Your result is @weight @mass', array('@weight' => $d->convertweight($frome, $value, $too), '@mass' => $form_state->getValue('masses')))); }