You are here

fb_instant_articles.install in Facebook Instant Articles 3.x

Install and update hooks.

File

fb_instant_articles.install
View source
<?php

/**
 * @file
 * Install and update hooks.
 */
use Facebook\InstantArticles\Transformer\Logs\TransformerLog;

/**
 * Change the enable_logging setting to transformer_logging_level.
 */
function fb_instant_articles_update_8201() {

  // Enable serialization module on update (is a dependency now).
  \Drupal::service('module_installer')
    ->install([
    'serialization',
  ]);
  $config = \Drupal::configFactory()
    ->getEditable('fb_instant_articles.settings');
  $enable_logging = $config
    ->get('enable_logging');
  if ($enable_logging) {
    $config
      ->set('transformer_logging_level', TransformerLog::ERROR);
  }
  else {
    $config
      ->set('transformer_logging_level', TransformerLog::OFF);
  }
  $config
    ->clear('enable_logging');
  $config
    ->save();
}

Functions

Namesort descending Description
fb_instant_articles_update_8201 Change the enable_logging setting to transformer_logging_level.