You are here

function hook_file_type_alter in File Entity (fieldable files) 8.2

Same name and namespace in other branches
  1. 7.3 file_entity.api.php \hook_file_type_alter()
  2. 7.2 file_entity.api.php \hook_file_type_alter()

Alters list of file types that can be assigned to a file.

Parameters

array $types: List of proposed types.

object $file: File object.

2 invocations of hook_file_type_alter()
FileAddForm::getCandidateFileTypes in src/Form/FileAddForm.php
Get the candidate filetypes for a given file.
FileEntity::determineType in src/Entity/FileEntity.php
Determines file type for a given file.

File

./file_entity.api.php, line 79
Hooks provided by the File Entity module.

Code

function hook_file_type_alter(&$types, $file) {

  // Choose a specific, non-first, file type.
  $types = array(
    $types[4],
  );
}