You are here

function commerce_add_to_cart_link_update_8101 in Commerce Add To Cart Link 8

Same name and namespace in other branches
  1. 2.x commerce_add_to_cart_link.install \commerce_add_to_cart_link_update_8101()

Set initial values for the new csrf_token settings.

File

./commerce_add_to_cart_link.install, line 11
Contains install and update functions for Commerce Add To Cart Link.

Code

function commerce_add_to_cart_link_update_8101() {

  /** @var \Drupal\user\RoleInterface[] $roles */
  $roles = \Drupal::entityTypeManager()
    ->getStorage('user_role')
    ->loadMultiple();
  \Drupal::configFactory()
    ->getEditable('commerce_add_to_cart_link.settings')
    ->set('csrf_token.roles', array_keys($roles))
    ->save();
}