function file_test_file_mimetype_mapping_alter

Same name in other branches
  1. 7.x modules/simpletest/tests/file_test.module \file_test_file_mimetype_mapping_alter()
  2. 8.9.x core/modules/file/tests/file_test/file_test.module \file_test_file_mimetype_mapping_alter()
  3. 10 core/modules/file/tests/file_test/file_test.module \file_test_file_mimetype_mapping_alter()
  4. 11.x core/modules/file/tests/file_test/file_test.module \file_test_file_mimetype_mapping_alter()

Implements hook_file_mimetype_mapping_alter().

File

core/modules/file/tests/file_test/file_test.module, line 298

Code

function file_test_file_mimetype_mapping_alter(&$mapping) {
    // Add new mappings.
    $mapping['mimetypes']['file_test_mimetype_1'] = 'madeup/file_test_1';
    $mapping['mimetypes']['file_test_mimetype_2'] = 'madeup/file_test_2';
    $mapping['mimetypes']['file_test_mimetype_3'] = 'madeup/doc';
    $mapping['extensions']['file_test_1'] = 'file_test_mimetype_1';
    $mapping['extensions']['file_test_2'] = 'file_test_mimetype_2';
    $mapping['extensions']['file_test_3'] = 'file_test_mimetype_2';
    // Override existing mapping.
    $mapping['extensions']['doc'] = 'file_test_mimetype_3';
}

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