Timeline for How do I create a Url object from the public file URI?
Current License: CC BY-SA 3.0
26 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 2 at 23:07 | answer | added | Dalin | timeline score: 0 | |
May 5, 2023 at 15:42 | answer | added | mevsme | timeline score: 1 | |
Apr 27, 2019 at 18:03 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Dec 19, 2018 at 19:01 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Nov 18, 2018 at 22:00 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Oct 19, 2018 at 8:00 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Sep 16, 2018 at 1:00 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Aug 15, 2018 at 15:02 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jul 11, 2018 at 4:51 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jun 7, 2018 at 3:47 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
May 2, 2018 at 10:06 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Nov 18, 2017 at 13:35 | answer | added | Christoph Burschka | timeline score: 2 | |
Nov 10, 2017 at 9:35 | history | edited | avpaderno♦ | CC BY-SA 3.0 |
removed "Drupal" and tags from the title
|
Oct 21, 2017 at 18:17 | history | tweeted | twitter.com/StackDrupal/status/921802625787580426 | ||
Sep 27, 2017 at 19:23 | comment | added | maskedjellybean |
Wow. I didn't really even need to generate a Url object to accomplish my needs. Just assigning the URL string was enough to generate the link properly: $vars['items'][$key]['url'] = $file_url; I then added a class to the menu item li element instead of the a element because $vars['items'][$key]['url'] is no longer an object and there is no way to add attributes. This is not ideal and doesn't answer the question I asked, but it is a way around it that works for my situation: $vars['items'][$key]['attributes']->addClass('menu-item--file-link');
|
|
Sep 27, 2017 at 19:08 | comment | added | maskedjellybean |
Thank you, I've edited the original question to include the full code. $file_uri is public://pdfs/Dashboard Saved Search.pdf $file_url is http://tee-prop.dev/sites/default/files/pdfs/Dashboard%20Saved%20Search.pdf
|
|
Sep 27, 2017 at 19:06 | history | edited | maskedjellybean | CC BY-SA 3.0 |
added 751 characters in body
|
Sep 27, 2017 at 11:26 | comment | added | mradcliffe | Can you post the full code around you're altering / changing the menu link? I think that might help clarify. | |
Sep 27, 2017 at 6:21 | comment | added | Ajay Reddy | Can you POST file URI here.. | |
Sep 27, 2017 at 4:14 | comment | added | maskedjellybean | That also fails with the same error. I wonder why is the Url being interpreted as external? | |
S Sep 27, 2017 at 0:23 | history | suggested | baikho | CC BY-SA 3.0 |
improved formatting
|
Sep 26, 2017 at 23:11 | comment | added | Berdir | file_create_url($file->getFileUri() should create an absolute path which should then work with fromUri(). | |
Sep 26, 2017 at 22:28 | comment | added | maskedjellybean | Thank you for the suggestion. Unfortunately that causes the same error. I can't believe how difficult this is. | |
Sep 26, 2017 at 22:06 | comment | added | mradcliffe |
I'm not sure if this will work for menu link URLs, but I think that external URLs are supported. This could be done by doing $menu_link['url'] = Url::fromUri($file_uri, ['absolute' => TRUE]); . I'm not confident in this, but I use this in freelinking module to send file URIs to Link render element's #uri property.
|
|
Sep 26, 2017 at 22:03 | review | Suggested edits | |||
S Sep 27, 2017 at 0:23 | |||||
Sep 26, 2017 at 21:37 | history | asked | maskedjellybean | CC BY-SA 3.0 |