/** * {@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')))); }