You are here

function fe_paths_file_process_available in File Entity Paths 7.2

Function to decide, if a file is available for File Entity Paths processing.

Parameters

$file:

Return value

bool

1 call to fe_paths_file_process_available()
fe_paths_file_process in ./fe_paths.module
Actually pre processes the files. Set a $file->fe_paths_processed flag on the file entity, then add to process queue. The file will be processed on drupal_register_shutdown.

File

./fe_paths.module, line 435
Contains functions for the File Entity Paths module.

Code

function fe_paths_file_process_available($file) {
  $return = TRUE;

  // Get a static of processed files to prevent infinite processing.
  $processed =& drupal_static(__FUNCTION__, array());

  // Critical return conditions. These files never must be processed.
  if (!file_entity_file_is_local($file)) {
    return FALSE;
  }

  // @todo: is this exists in this structure? We just try it.
  if (!isset($file->type)) {
    watchdog('File Entity devel helper', '<em>!isset($file->type)</em> condition was marked as removable in File Entity Paths module. If you still see this message in log, please let me know in <a href="http://drupal.org/node/1783934">Check whether all condition need in the fe_paths_file_process_available()</a> issue.');
    return FALSE;
  }
  if (!array_key_exists($file->origname, $processed)) {
    $processed[$file->origname] = TRUE;
  }
  else {
    $return = FALSE;
  }

  // Clone the original file to pass as none alterable argument
  $clone = clone $file;

  // Let other modules to set $return to FALSE.
  drupal_alter('fe_paths_file_process_available', $return, $clone);
  return $return;
}