You are here

commerce_add_to_cart_link.install in Commerce Add To Cart Link 8

Same filename and directory in other branches
  1. 2.x commerce_add_to_cart_link.install

Contains install and update functions for Commerce Add To Cart Link.

File

commerce_add_to_cart_link.install
View source
<?php

/**
 * @file
 * Contains install and update functions for Commerce Add To Cart Link.
 */

/**
 * Set initial values for the new csrf_token settings.
 */
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();
}

Functions

Namesort descending Description
commerce_add_to_cart_link_update_8101 Set initial values for the new csrf_token settings.