function PoDatabaseWriter::setOptions

Same name in other branches
  1. 8.9.x core/modules/locale/src/PoDatabaseWriter.php \Drupal\locale\PoDatabaseWriter::setOptions()
  2. 10 core/modules/locale/src/PoDatabaseWriter.php \Drupal\locale\PoDatabaseWriter::setOptions()
  3. 11.x core/modules/locale/src/PoDatabaseWriter.php \Drupal\locale\PoDatabaseWriter::setOptions()

Set the options for the current writer.

Parameters

array $options: An associative array containing:

  • overwrite_options: An array of options. Each option contains:

    • not_customized: Boolean indicating that not customized strings should be overwritten.
    • customized: Boolean indicating that customized strings should be overwritten.
  • customized: The strings being imported should be saved as customized. One of LOCALE_CUSTOMIZED or LOCALE_NOT_CUSTOMIZED.

File

core/modules/locale/src/PoDatabaseWriter.php, line 123

Class

PoDatabaseWriter
Gettext PO writer working with the locale module database.

Namespace

Drupal\locale

Code

public function setOptions(array $options) {
    if (!isset($options['overwrite_options'])) {
        $options['overwrite_options'] = [];
    }
    $options['overwrite_options'] += [
        'not_customized' => FALSE,
        'customized' => FALSE,
    ];
    $options += [
        'customized' => LOCALE_NOT_CUSTOMIZED,
    ];
    $this->options = $options;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.