You are here

function lazy_post_update_add_csseffect_option in Lazy-load 8.3

Update lazy module configuration for the new "cssEffect" option.

File

./lazy.post_update.php, line 25
Lazy module post updates.

Code

function lazy_post_update_add_csseffect_option() {
  $config = \Drupal::configFactory()
    ->getEditable('lazy.settings');

  // If it's already set use that value, otherwise set to false.
  $cssEffect = (bool) ($config
    ->get('cssEffect') ?? FALSE);
  $config
    ->set('preferNative', $cssEffect)
    ->save(TRUE);
  return t('The new "cssEffect" option is added, and set to %status. (Default: <em>false</em>)', [
    '%status' => $cssEffect ? 'enabled' : 'disabled',
  ]);
}