This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

How can I get the menu ui link from a node?

I'm trying to get a specific menu link to a node but we have a giant menu structure with more than one link to the same node.

$menu_links = $menu_link_service->loadLinksByRoute('entity.node.canonical', $route_params, $menu_name);

This code works but $menu_links sometimes has multiple links.  The Menu UI module somehow keeps track of only a single menu link even if there are multiple links in the same menu to that node. I'm calling this the menu ui link, though maybe there's a better way to refer to it.

system_retrieve_file() not working correct

Hello Everyone, 

when I'm calling system_retrieve_file like:

$thumbnail = system_retrieve_file($thumbnail_url, NULL, TRUE, FileSystemInterface::EXISTS_REPLACE);

It will download the image into file system but when I try to print $thumbnail object it will have empty fid (file id). 

Note: when I ran the same code again with the same thumbnail url, it gave me the fid. 

Not sure why at first place fid is empty. 

Download file from authenticated file URL

Thanks in Advance!!
 

In my site, Some media's assets are stored in private folder. I have a custom form where i am using these media assets. When user load the page they are granted the access to use those medias by "private file download access" module. My question is when user submit the form. These media should be also save in public folder. I am doing this by file_get_contents() function (download file from url). See the below code:

Filter table by ajax submitting not refresh pagination.

Dear Drupal community,

Need help, pagination not reset after filtering table via ajax submitting. Guide me what I am doing wrong.

Trusted Host Settings

I followed the link to https://www.drupal.org/docs/installing-drupal/trusted-host-settings followed the instructions. They echo my video tutorial instruction.

I edited sites>default>setting.php

$settings['trusted_host_patterns'] = [
  '^www\.ukspeaking\.com$',
 ];

it returns this message on my site:-

'The provided host name is not valid for this server.'

How to set File from temporary://file.jpg

I thought I could figure this out, reading the Entity\File.php class governing this entity.

Through a theme, I've uploaded an image in its logo upload form in its settings. I see the file in managed_file with a URI of 'temporary://mylogo.jpg'and a status of 0 which indicates to me that it's in a temporary state that will be destroyed during the next cron run. 

In drush php,

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions