You are here

function remote_stream_wrapper_menu in Remote Stream Wrapper 7

Implements hook_menu().

File

./remote_stream_wrapper.module, line 18
Provides a remote stream wrapper and file field integration.

Code

function remote_stream_wrapper_menu() {
  $items = array();
  $items['file/add/remote'] = array(
    'title' => 'Remote',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'remote_stream_wrapper_file_add_form',
    ),
    'access callback' => 'remote_stream_wrapper_media_browser_plugin_access',
    'type' => MENU_LOCAL_TASK,
  );

  // Add image style generation paths for external URLs.
  if (module_exists('image')) {
    $wrappers = file_get_remote_stream_wrappers();
    $directory_path = file_stream_wrapper_get_instance_by_scheme(file_default_scheme())
      ->getDirectoryPath();
    $pos = count(explode('/', $directory_path)) + 1;
    $item = array(
      'page callback' => 'remote_stream_wrapper_image_style_deliver',
      'page arguments' => array(
        $pos,
        $pos + 1,
      ),
      'access callback' => TRUE,
      'type' => MENU_CALLBACK,
      'file' => 'remote_stream_wrapper.image.inc',
    );
    foreach (array_keys($wrappers) as $scheme) {
      $items[$directory_path . '/styles/%image_style/' . $scheme] = $item;
    }
  }
  return $items;
}