function action_step1save() { if (empty($_REQUEST['apikey'])) { // you must enter an apikey return $this->action_step1(array('You must provide an api key.')); } $scapi = new AddonBoilerplateApi(); $data = $scapi->updateApiKey(null, array('apikey' => $_REQUEST['apikey'])); if (empty($data['success']) || $data['success'] !== true) { // failed to connect and save return $this->action_step1(array('The api key failed to save: ' . $data['message'])); } $this->action_step2(); }