It is likely that the most common use case of the module is just rendering the word permalink, formatted as a link, at the bottom of the content. So without the need for a copy box.
In that case, a large portion of the code can be skipped to improve the regeneration of the block in case the cache is cleared. We just have to insert a conditional that checks the setting No copy box and skips grabbing the site name, slogan, page title, and the whole generation of the HTML code snippet.
Furthermore, we might as well make that the default setting when enabling the module (no block title, no copy box).
Comments
Comment #2
lolandese commentedThe attached patch:
Comment #3
lolandese commentedLet's try without the .gitignore. We try to delete the annoying macOS files, but these are also in the .gitignore.
Comment #4
lolandese commentedComment #5
lolandese commentedOkay. Was solved using:
martin@martin-XPS-13-9370 /var/www/html/d9.localhost/web/modules/contrib/permalink_block (8.x-1.x +=) $ git diff-index 13968d58302ef3d6ea0121f4f20666b2fe5ea1d4 --binary > permalink_block-skip_unnecessary_code-3133718-4.patchSource: git cannot apply binary patch *** without full index line - Stack Overflow
Comment #7
lolandese commentedComment #8
lolandese commentedModule installation seems to have some hiccup. The Permalink shows correctly without the copy box, but No copybox is unselected in the block settings. Thus the copy box is rendered after saving the block settings "as is".
Furthermore, before we got a notice on module enabling, even with drush.
We lost that now:
Comment #9
lolandese commentedThe notice not visible in the terminal is a difference between Drush 10 and Drush 8. Probably it caused problems and they removed the feature. I tried to search the GitHub issue queue but could find anything clear on it. A pity, as I liked the feature.
Settings to suppress the copy box were in the wrong place, thus ignored. The patch fixes it.
Comment #11
lolandese commented