Closed (fixed)
Project:
Block Title Links
Version:
1.1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Sep 2020 at 21:09 UTC
Updated:
1 Jun 2021 at 06:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
smustgrave commentedThis was a small workaround I did. Then I could add links like internal:/my-link
Comment #3
neslee canil pintoComment #5
neslee canil pintoComment #7
dark_kz commentedSti
Comment #8
dark_kz commentedStill not working in the 1.1 version
Comment #10
smustgrave commentedCan't reopen the ticket but I pushed up a new fix in that PR if you want to give it a shot. Borrowed a lot of the code from the core link widget.
Comment #11
neslee canil pintoHi guys, why is this merge request for?
Comment #12
smustgrave commentedSeems this issue was not resolved completely. Took another shot at it and believe it should be working now.
Comment #13
neslee canil pintoOk I will be opening it again
Comment #14
neslee canil pintoComment #16
nick hope commentedI am attempting to switch over from the older Block Title Link module because of lack of activity there with producing a stable D8/D9 version.
However I am also experiencing this issue in both 1.1.2 and 1.1.x-dev (5 Mar 2021) in Drupal 8.9.13. It will not accept internal links such as `/authorities`. When I try to save the block it just prompts "Please enter a URL".
I was able to enter this type of link in the other Block Title Link module (also with D8.9.13 and with this patch).
Comment #17
kazah commentedI confirm the internal paths still don't work! Drupal 9.1.7
I think you need to reopen the ticket.
Comment #18
neslee canil pintoComment #19
anybodyYep, I can also confirm #16
Comment #20
smustgrave commentedNot sure what happened but the changes in the PR https://git.drupalcode.org/project/block_title_link/-/merge_requests/1/d... aren't in the 1.1.x branch. But if you apply as patch does it work?
Comment #21
nick hope commented@smustgrave The diff you linked to will apply to 1.1.2 (which I guess is the same as 1.1.x-dev - both dated 5th March), but the following error is thrown when visiting a Configure block page (in both Drupal 8.9.14 and 9.1.7):
Edit: I went ahead and checked it with 1.1.x-dev and the same error is thrown.
Comment #22
smustgrave commentedSo part of the solution I took from core menu_link. Because this code is in the .module file I wonder if you can't call get_called_class from there.
Comment #23
nick hope commentedThere may be inspiration in the older Block Title Link module, but it's a bit of a mess because not even a D8 dev version was ever released. But a working D8 version can be constructed using my patch against the D7 version. Internal links worked OK in it.
Comment #25
smustgrave commentedOpened up a new PR to try and address it. I'm sure there's a better way to get the url string then copying getUriAsDisplayableString but I couldn't figure out yet. Without that function the field still saves and validates but the value would have internal:: in the string
Comment #26
nick hope commented#24 is working for internal links (by patching with https://git.drupalcode.org/project/block_title_link/-/merge_requests/2/diffs.diff), so thank you for that.
Regarding #20,
get_called_class()has been completely removed from core and replaced withstatic::class(see here and here). So after patching with #20 I tried replacing'#element_validate' => [[get_called_class(), 'validateUriElement']],with the apparently-like-for-like'#element_validate' => [[static::class, 'validateUriElement']],. VSCode tells me 'Cannot use "static" when no class scope is active'. Which led me to this. Does it help? I'm not a coder.Comment #27
smustgrave commentedI got the same error when i tried. I think it’s because we are in the modules file and that needs to be called in a class.
So maybe the module needs to be refactored to use classes vs hooks? Not sure myself
Comment #28
neslee canil pinto@smustgrave got this error when it tried to access any block config page
Comment #29
smustgrave commentedHaven't had that issue. When I wrote that I was only Drupal core 9.2
Comment #30
neslee canil pintoAdd block title data to any of the block configs, save it, and then when you revisit it, this error is occurring, and I am also using core 9.2
Comment #31
nick hope commentedI haven't seen error #28 using Drupal 9.1.7/8. I'm only using this module for links on the titles of Hierarchical Taxonomy Menu blocks.
Comment #32
neslee canil pintoOk, we had to add
use Drupal\Core\Entity\Element\EntityAutocomplete;, because of this error was occurring for me, will commit it and make a release soon.Comment #34
neslee canil pintoCommitted to the dev branch, will create new release soon 👍🏻. Thanks.
Comment #35
smustgrave commentedGlad you got it working! Sorry I couldn't take a look. Work took all my time the last week.
Comment #36
nick hope commentedThanks guys. 1.1.3 working fine in D9.1.8.