You are here

function mailchimp_webhook_url in Mailchimp 2.x

Same name and namespace in other branches
  1. 8 mailchimp.module \mailchimp_webhook_url()
  2. 7.5 mailchimp.module \mailchimp_webhook_url()
  3. 7.2 mailchimp.module \mailchimp_webhook_url()
  4. 7.3 mailchimp.module \mailchimp_webhook_url()
  5. 7.4 mailchimp.module \mailchimp_webhook_url()

Generates the webhook endpoint URL.

Return value

string The endpoint URL.

3 calls to mailchimp_webhook_url()
MailchimpAdminSettingsForm::buildForm in src/Form/MailchimpAdminSettingsForm.php
Form constructor.
MailchimpListsWebhookSettingsForm::submitForm in modules/mailchimp_lists/src/Form/MailchimpListsWebhookSettingsForm.php
Form submission handler.
mailchimp_lists_enabled_webhook_events in modules/mailchimp_lists/mailchimp_lists.module
Returns an array of enabled webhook events.

File

./mailchimp.module, line 1097
Mailchimp module.

Code

function mailchimp_webhook_url($hash = NULL, $lang = NULL) {
  if (is_null($hash)) {
    $hash = \Drupal::config('mailchimp.settings')
      ->get('webhook_hash');
  }
  if (is_null($lang)) {
    $lang = \Drupal::languageManager()
      ->getDefaultLanguage()
      ->getId();
  }
  return Url::fromRoute('mailchimp.webhook_endpoint', [
    'hash' => $hash,
    'language' => $lang,
  ])
    ->setAbsolute()
    ->toString();
}