Commit 21f6cb41 authored by Daniel Pepin's avatar Daniel Pepin
Browse files

Issue #2536510: Fix error on webhooks page when API calls fail.

parent 9e90bb54
Loading
Loading
Loading
Loading
+7 −0
Changes for src/Form/ShopifyWebhooksAdminForm.php: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -39,8 +39,15 @@ class ShopifyWebhooksAdminForm extends ConfigFormBase {
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    try {
      $client = shopify_api_client();
      $webhooks = $client->getResources('webhooks');
    } catch (\Exception $e) {
      // Error connecting to the store.
      drupal_set_message(t('Could not connect to the Shopify store.'), 'error');
      return [];
    }

    $config = $this->config('shopify.webhooks');

    $form['#tree'] = TRUE;