You are here

function hook_tmgmt_smartling_filename_alter in TMGMT Translator Smartling 8.3

Same name and namespace in other branches
  1. 8.4 tmgmt_smartling.api.php \hook_tmgmt_smartling_filename_alter()
  2. 8.2 tmgmt_smartling.api.php \hook_tmgmt_smartling_filename_alter()

Alter translation file name.

Parameters

string $name:

JobInterface $job:

1 function implements hook_tmgmt_smartling_filename_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

tmgmt_smartling_test_alter_filename_tmgmt_smartling_filename_alter in modules/tmgmt_smartling_test/modules/tmgmt_smartling_test_alter_filename/tmgmt_smartling_test_alter_filename.module
Alter translation file name.
1 invocation of hook_tmgmt_smartling_filename_alter()
SmartlingTranslator::getFileName in src/Plugin/tmgmt/Translator/SmartlingTranslator.php
Returns file name.

File

./tmgmt_smartling.api.php, line 28
Hooks provided by the TMGMT Smartling module.

Code

function hook_tmgmt_smartling_filename_alter(&$name, JobInterface $job) {

  // Example: filename = job's label. If you have only one job item in a job
  // then file name will look like "[node_title]_job_id_[id]". If there are more
  // than 1 job item inside a job then filename will look like
  // "[node_title]_and_[n]_more_job_id_[id]". If you enter your own job label
  // then filename will look like "[your_own_label]_job_id_[id]"
  $name = preg_replace('/[^a-zA-Z0-9_\\-\\:]/i', '_', $job
    ->label()) . '_job_id_' . $job
    ->id();
}