1 file_example.module file_example_stream_wrappers()

Implements hook_stream_wrappers().

hook_stream_wrappers() is Backdrop's way of exposing the class that PHP will use to provide a new stream wrapper class. In this case, we'll expose the 'session' scheme, so a file reference like "session://example/example.txt" is readable and writable as a location in the $_SESSION variable.

See also

FileExampleSessionStreamWrapper

Related topics

File

modules/examples/file_example/file_example.module, line 525
Examples demonstrating the backdrop File API (and Stream Wrappers).

Code

function file_example_stream_wrappers() {
  $wrappers = array(
    'session' => array(
      'name' => t('Example: $_SESSION variable storage'),
      'class' => 'FileExampleSessionStreamWrapper',
      'description' => t('Store files in the $_SESSION variable as an example.'),
    ),
  );
  return $wrappers;
}