New answers tagged

0

I'd use RecursiveDirectoryIterator for that. $path = '/your/awesome/absolute/path'; $dir = new RecursiveDirectoryIterator($path); $json_files = new RegexIterator($dir, '/\.json$/'); foreach ($json_files as $file) { // Do you stuff here. echo "$file"; }


0

I found the reason of this problem finally. It was as a result of jQuery code mistakes. in form submission, I tried to disable submit button immediately after clicking. I had to change the coding because set button disable causes this problem.


0

If you just have a static file(s) on your server that you want users to download, such as in the /files dir (suggest using /files/downloads/[filename]). You will want to create a route and controller for this. Then render the link via the route in a block. You could also have a form whos submit handler calls the route with required filename. This should ...


0

I can highly recommend DropzoneJS. It is a well maintained project, and will make it not only very easy for you to add a file upload widget with a specified max of files (or unlimited), it also provides a superior UX. You can grab the module here: https://www.drupal.org/project/dropzonejs Once you clone down the library from their GitHub repo, and enable ...


0

I had difficulties doing this too. The trick is to use getEntitiesToView() indeed. To get the function working, the following use statement is essential: use Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase; Full code for the formatter can be found here: https://stefvanlooveren.me/blog/show-file-description-custom-formatter-drupal-8


0

The solution to this problem is to load the group content from the node to which the field entity is attached. // This field is a node entity $node = $items->getEntity(); $type = $node->bundle(); $group_content_types = GroupContentType::loadByContentPluginId("group_node:$type"); $group_content = reset($group_contents); This same logic also works for ...


1

How can i change Public file system path in Drupal 8? You can add the following line to either your settings.php file, or your settings.local.php file. E.g. docroot/sites/default/settings.php $settings['file_public_path'] = '/sites/default/files/my_custom_folder'; And can you tell more about how to increase the storage of database? I have no idea ...


1

Actually, I don't see the need to encrypt images as Private files will hide the images from direct access and will be served by Drupal. You can find more about private files here Encryption and decryption each time the node is viewed can have serious performance implications. The only scenario that I would think of having encryption when there is a ...


Top 50 recent answers are included