- Issue created by @apaderno
- ๐ช๐ธSpain fjgarlin
My suggestion is to add a "Git URL" field to the Project entity that, when populated, will make the link to the source code be shown. If the link is not populated, then no link will be shown.
- Status changed to Needs review
10 months ago 1:48pm 19 June 2024 - ๐ช๐ธSpain fjgarlin
The MR is ready for review.
As this module is theme agnostic, it just adds the link with wrapping classes and a "git" icon. Any theme can easily format that div and icon as needed. The default look is:
If the approach here is good, we will create a Bluecheese issue to style this new element.
- ๐ญ๐บHungary Gรกbor Hojtsy Hungary
Yay! Great feature. I think "View file on ..." would be the proper English not "in"? Otherwise UI looks good. Did not review the code in detail.
- ๐ช๐ธSpain fjgarlin
Bluecheese issue: #3455724: Style new element in api site โ
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
Just a little note: Code like
new TranslatableMarkup('@link_to_file', ['@link_to_file' => Formatter::linkFile($file_entity)]);
does not get translations. What the people who translate on localize.drupal.org see as text to translate is @link_to_file, and since that is a placeholder, they would just put @link_to_file because placeholders are not translated. - ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
That is not really an issue is what returned from
Formatter::linkFile($file_entity)
is already a translated string; otherwise,$link_to_file = new TranslatableMarkup('@link_to_file', ['@link_to_file' => Formatter::linkFile($file_entity)]);
will always show a link in English.If
Formatter::linkFile($file_entity)
returns a translated string, then it is not necessaryTranslatableMarkup
, butFormattableMarkup
- ๐ช๐ธSpain fjgarlin
Changed the text to "View on" as the word "File" is just above and is not needed.
Also changed the translatable strings to use the direct value instead (I know this is not part of this issue but I'm just trying to get in as a quick fix to remote the phpcs issues).
- ๐ง๐ชBelgium BramDriesen Belgium ๐ง๐ช
Added a few small remarks. Nothing major so leaving at NR.
- ๐ง๐ชBelgium BramDriesen Belgium ๐ง๐ช
Funky, about the order. But if style-lint is happy I guess it's good ;-)
- Status changed to Needs work
about 14 hours ago 12:41pm 8 April 2025 - ๐ณ๐ฟNew Zealand quietone
Now that the code on api.drupal.org is rendered using a four-space indentation and two empty lines are put between functions/methods,
Why is the format of the source changed?
Testing locally the link is displayed on class files but it was displayed on *.api.php.