You are here

function tmgmt_smartling_update_8001 in TMGMT Translator Smartling 8

Same name and namespace in other branches
  1. 8.4 tmgmt_smartling.install \tmgmt_smartling_update_8001()
  2. 8.2 tmgmt_smartling.install \tmgmt_smartling_update_8001()
  3. 8.3 tmgmt_smartling.install \tmgmt_smartling_update_8001()

Set default custom_regexp_placeholder string.

File

./tmgmt_smartling.install, line 12
Update function for the tmgmt_smartling module.

Code

function tmgmt_smartling_update_8001() {
  $custom_regexp_placeholder = \Drupal::config('tmgmt.translator.smartling')
    ->get('settings.custom_regexp_placeholder');

  // Update custom_regexp_placeholder if not already set.
  if (empty($custom_regexp_placeholder)) {
    \Drupal::configFactory()
      ->getEditable('tmgmt.translator.smartling')
      ->set('settings.custom_regexp_placeholder', '(@|%|!)[\\w-]+')
      ->save(TRUE);
  }
}