You are here

function mailchimp_addto_queue in Mailchimp 8

Same name and namespace in other branches
  1. 7.5 mailchimp.module \mailchimp_addto_queue()
  2. 7.3 mailchimp.module \mailchimp_addto_queue()
  3. 7.4 mailchimp.module \mailchimp_addto_queue()
  4. 2.x mailchimp.module \mailchimp_addto_queue()

Adds a Mailchimp subscription task to the queue.

Parameters

string $function: The name of the function the queue runner should call.

array $args: The list of args to pass to the function.

Return value

mixed Unique ID if item is successfully added to the queue, FALSE otherwise.

3 calls to mailchimp_addto_queue()
mailchimp_subscribe in ./mailchimp.module
Subscribe a user to a Mailchimp list in real time or by adding to the queue.
mailchimp_unsubscribe in ./mailchimp.module
Unsubscribes a member from a Mailchimp list.
mailchimp_update_member in ./mailchimp.module
Update a members list subscription in real time or by adding to the queue.

File

./mailchimp.module, line 605
Mailchimp module.

Code

function mailchimp_addto_queue($function, array $args) {
  $queue = \Drupal::queue(MAILCHIMP_QUEUE_CRON);
  $queue
    ->createQueue();
  return $queue
    ->createItem([
    'function' => $function,
    'args' => $args,
  ]);
}