You are here

function _token_example_get_file in Examples for Developers 7

Builds a list of available files.

Related topics

File

token_example/token_example.module, line 218
An example module showing how to define and use tokens.

Code

function _token_example_get_file() {
  $file_query = db_select('file_managed', 'f');
  $file_query
    ->fields('f', array(
    'fid',
    'filename',
  ));
  $file_query
    ->range(0, 10);
  $files = $file_query
    ->execute()
    ->fetchAllKeyed();
  $files = array_map('check_plain', $files);
  return $files;
}