This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_form_node_form_alter(). | |
*/ | |
function your_module_form_node_form_alter(&$form, &$form_state, $form_id) { | |
$node = \Drupal::request()->attributes->get('node'); | |
// If it's the edit form as opposed to the add form. | |
if (!empty($node)) { | |
$orig_title = $node->getTitle(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Controller/DownloadController.php b/src/Controller/DownloadController.php | |
index 09bfdf6..0735f54 100644 | |
--- a/src/Controller/DownloadController.php | |
+++ b/src/Controller/DownloadController.php | |
@@ -7,11 +7,9 @@ use Drupal\Core\File\FileSystemInterface; | |
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface; | |
use Symfony\Component\HttpFoundation\BinaryFileResponse; | |
use Drupal\media\MediaInterface; | |
-use Symfony\Component\HttpFoundation\Response; | |
-use Symfony\Component\HttpFoundation\ResponseHeaderBag; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // If there is audio content, print it with it's description. | |
if (isset($content['field_audio_file'])) { | |
// Hide so we can display it later. | |
hide($content['field_audio_file']); | |
print '<div class="field-item">'; | |
// Loop through each audio file. | |
$audiofiles = $content['field_audio_file']['#items']; | |
foreach ($audiofiles as $delta => $audiofile) { | |
$uri = $audiofile['uri']; | |
$audiopath = file_create_url($uri); // Converts uri to path format. |