<?php

/**
 * @file
 * Contains install and update routines for WxT Extend Metatag.
 */

/**
 * Replaces metatag_page_variants module with metatag_page_manager module.
 */
function wxt_ext_metatag_update_8001() {
  // Remove metatag_page_variants module.
  \Drupal::database()->delete('key_value')
    ->condition('collection', 'system.schema')
    ->condition('name', 'metatag_page_variants')
    ->execute();

  // Enable metatag_page_manager module.
  \Drupal::service('module_installer')->install(['metatag_page_manager']);
}

/**
 * Updates field_meta_tags on 'Basic page' content type to be translatable.
 */
function wxt_ext_metatag_update_8002() {
  $config = \Drupal::configFactory()->getEditable('field.field.node.page.field_meta_tags');
  $config->set('translatable', TRUE);
  $config->save();
}
