1 file.module _file_view_mode_menu_access($file_type, $view_mode, $access_callback)

Menu access callback for the 'view mode file display settings' pages.

Based on _field_ui_view_mode_menu_access(), but the Field UI module might not be enabled.

File

core/modules/file/file.module, line 2596
Defines a "managed_file" Form API field and a "file" field for Field module.

Code

function _file_view_mode_menu_access($file_type, $view_mode, $access_callback) {
  // Deny access if the view mode isn't configured to use custom display
  // settings.
  $view_mode_settings = field_view_mode_settings('file', $file_type->type);
  $visibility = ($view_mode == 'default') || !empty($view_mode_settings[$view_mode]['custom_settings']);
  if (!$visibility) {
    return FALSE;
  }

  // Otherwise, continue to an $access_callback check.
  $args = array_slice(func_get_args(), 3);
  $callback = empty($access_callback) ? 0 : trim($access_callback);
  if (is_numeric($callback)) {
    return (bool) $callback;
  }
  elseif (function_exists($access_callback)) {
    return call_user_func_array($access_callback, $args);
  }
}