diff --git a/file_example/file_example.info.yml b/file_example/file_example.info.yml index 4cce44e..5e2f1d1 100644 --- a/file_example/file_example.info.yml +++ b/file_example/file_example.info.yml @@ -5,3 +5,4 @@ package: Example modules core: 8.x dependencies: - examples + - file diff --git a/file_example/file_example.module b/file_example/file_example.module index 5c34718..601f66d 100644 --- a/file_example/file_example.module +++ b/file_example/file_example.module @@ -27,13 +27,14 @@ * * * Using special "stream" URIs like public://, private://, and temporary://. * Drupal has good support for this PHP language feature. You can implement - * new file schemes as well; see the Stream Wrapper Example for how to do that. - * If you enable the stream_wrapper_example module, you can use it together - * with the File Example to test how a custom stream works. + * new file schemes as well; see the Stream Wrapper Example for how to do + * that.If you enable the stream_wrapper_example module, you can use it + * together with the File Example to test how a custom stream works. * * To demonstrate all of this, the File Example implements a form that lets you - * play with files. Read src/Form/FileExampleReadWriteForm.php to see demostrations - * of the various File API functions you will want to use in your code. + * play with files. Read src/Form/FileExampleReadWriteForm.php to see + * demonstrations of the various File API functions you will want to use in your + * code. * * Some links for further information on the File API and related information: * @@ -43,7 +44,7 @@ */ /** - * Control access to private file downloads and specify HTTP headers. + * Implements hook_file_download(). * * This hook allows modules to enforce permissions on file downloads whenever * Drupal is handling file download, as opposed to the web server bypassing diff --git a/file_example/file_example.routing.yml b/file_example/file_example.routing.yml index 8943442..d07a754 100644 --- a/file_example/file_example.routing.yml +++ b/file_example/file_example.routing.yml @@ -6,4 +6,3 @@ file_example.fileapi: _title: 'File Example: Use the File API to read/write a file' requirements: _permission: 'use file example' - diff --git a/file_example/src/Form/FileExampleReadWriteForm.php b/file_example/src/Form/FileExampleReadWriteForm.php index 9cc526c..aece261 100644 --- a/file_example/src/Form/FileExampleReadWriteForm.php +++ b/file_example/src/Form/FileExampleReadWriteForm.php @@ -1,10 +1,5 @@ state = $state; $this->fileSystem = $file_system; $this->moduleHandler = $module_handler; @@ -596,9 +592,9 @@ class FileExampleReadWriteForm extends FormBase { * file_get_contents("public://somefile.txt") just works. Although it's * not necessary, we use file_unmanaged_save_data() to save this file locally * and then find a local URL for it by using file_create_url(). - * * @param array $form - * An associative array containing the structure of the form. * + * @param array $form + * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. */ @@ -804,13 +800,13 @@ class FileExampleReadWriteForm extends FormBase { /** * Utility submit function to reset the demo. * - * Note this does NOT clear any managed file references in Drupal's DB. - * Perhaps we should do this as well. - * * @param array $form * FormAPI form. * @param FormStateInterface $form_state * FormAPI form state. + * + * @todo Note this does NOT clear any managed file references in Drupal's DB. + * It might be a good idea to add this. */ public function handleResetSession(array &$form, FormStateInterface $form_state) { $this->state->delete('file_example_default_file'); diff --git a/file_example/src/Tests/FileExampleTest.php b/file_example/src/Tests/FileExampleTest.php index 3521cc0..caad60a 100644 --- a/file_example/src/Tests/FileExampleTest.php +++ b/file_example/src/Tests/FileExampleTest.php @@ -1,10 +1,4 @@ $content, 'destination' => $filename, ); - $options = []; - if (($scheme == 'session') and ($expected_text[$button] == 'Saved managed file')) { - // $options['query'] = []; - // $options['query']['XDEBUG_SESSION_START'] = 'PHPSTORM';. - } - $this->drupalPostForm('examples/file_example', $edit, $button, $options); + $this->drupalPostForm('examples/file_example', $edit, $button); debug($expected_text[$button], "Button Text"); $this->assertText($expected_text[$button]);