You are here

public function ClientEditForm::submitForm in Acquia Content Hub 8.2

Throws

\Exception

Overrides FormInterface::submitForm

File

modules/acquia_contenthub_publisher/src/Form/Client/ClientEditForm.php, line 53

Class

ClientEditForm
Class ClientEditForm.

Namespace

Drupal\acquia_contenthub_publisher\Form\Client

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->setRedirect('acquia_contenthub.subscription_settings');
  $name = trim($form_state
    ->getValue('name'));

  /** @var \Psr\Http\Message\ResponseInterface $response */
  $response = $this->client
    ->updateClient($this->uuid, $name);
  if (!$this
    ->isResponseSuccessful($response, $this
    ->t('update'), $this
    ->t('client'), $this->uuid, $this
    ->messenger())) {
    return;
  }
  $this
    ->messenger()
    ->addStatus($this
    ->t('Client %uuid has been updated.', [
    '%uuid' => $this->uuid,
  ]));
}