Problem/Motivation

Many providers like to see their logo on the translator/provider settings page.

Originally we were unclear if we are allowed to add the Logo to the GPL code on drupal.org
The Drupal Association and Dries recently confirmed that the GPL only applies to Code and not to assets such as a company logo.
Thus projects are allowed to upload logos to the repository.

Proposed resolution

Add a provider logo to each provider definition.

The logo will be displayed
- In the provider list overview as separate column
- In the provider settings form, floated right
The bounding box will be limited with a max height / width to avoid breaking design.

Update the existing providers.

Remaining tasks

Unsure if this is custom to each provider or if we want to allow a logo reference in annotation or some other way such as an interface.

User interface changes

Show logo and through that make the user feel it is more official and services can be visually identified.

API changes

Annotation or interface?

CommentFileSizeAuthor
#28 interdiff-meta_add_provider-2713243-26-28.txt372 bytesedurenye
#28 meta_add_provider-2713243-28.patch8 KBedurenye
#26 interdiff-meta_add_provider-2713243-21-26.txt4.47 KBedurenye
#26 meta_add_provider-2713243-26.patch8.02 KBedurenye
#26 meta_add_provider-2713243-26-12.png17.89 KBedurenye
#26 meta_add_provider-2713243-26-11.png21.56 KBedurenye
#26 meta_add_provider-2713243-26-10.png13.58 KBedurenye
#26 meta_add_provider-2713243-26-9.png32.54 KBedurenye
#26 meta_add_provider-2713243-26-8.png32.24 KBedurenye
#26 meta_add_provider-2713243-26-7.png26.18 KBedurenye
#26 meta_add_provider-2713243-26-6.png30.11 KBedurenye
#26 meta_add_provider-2713243-26-5.png34.78 KBedurenye
#26 meta_add_provider-2713243-26-4.png29 KBedurenye
#26 meta_add_provider-2713243-26-3.png29.47 KBedurenye
#26 meta_add_provider-2713243-26-2.png29.15 KBedurenye
#26 meta_add_provider-2713243-26-1.png40.52 KBedurenye
#21 interdiff-meta_add_provider-2713243-19-21.txt2.3 KBedurenye
#21 meta_add_provider-2713243-21.patch6.04 KBedurenye
#19 interdiff-meta_add_provider-2713243-16-19.txt322 bytesedurenye
#19 meta_add_provider-2713243-19.patch6.02 KBedurenye
#19 meta_add_provider-2713243-19.png43.22 KBedurenye
#16 interdiff-meta_add_provider-2713243-8-16.txt3.12 KBedurenye
#16 meta_add_provider-2713243-16.patch6 KBedurenye
#16 meta_add_provider-2713243-16.png42.88 KBedurenye
#8 interdiff-meta_add_provider-2713243-4-8.txt3.32 KBedurenye
#8 meta_add_provider-2713243-8.patch6.05 KBedurenye
#8 meta_add_provider-2713243-8-test_only.patch721 bytesedurenye
#8 meta_add_provider-2713243-8.png33.92 KBedurenye
#4 meta_add_provider-2713243-4.patch3.94 KBedurenye
#4 meta_add_provider-2713243-4-gengo.png68.66 KBedurenye
#4 meta_add_provider-2713243-4-google.png26.46 KBedurenye
#4 meta_add_provider-2713243-4-microsoft.png27.04 KBedurenye
#4 meta_add_provider-2713243-4-oht.png53.33 KBedurenye
#4 meta_add_provider-2713243-4-thebigword.png65 bytesedurenye
#4 meta_add_provider-2713243-4-overview.png50.3 KBedurenye
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

miro_dietiker created an issue. See original summary.

edurenye’s picture

Issue summary: View changes
edurenye’s picture

We will provide logo, preferably as svg, by annotation. The preferred aspect ratio is wide due to the overview output.
The test translator will also provide one to test cover it.
Neither XLIFF nor Local / Drupal translator will have a logo.

edurenye’s picture

miro_dietiker’s picture

Status: Needs review » Needs work

This looks great.
But we need the follow-ups in the individual projects with the logos added / annotated.

I think the logo column doesn't need a "Logo" label in the header.

Also i caught "TRANSLATOR NAME" in the column overview that should have been renamed to Provider already...
Anyway, if i edit, it's called "Label" instead of "Name" and IMHO "TRANSLATOR" is redundant anyways - so we should drop it and switch to "Label" only.

+++ b/src/Entity/ListBuilder/TranslatorListBuilder.php
@@ -105,13 +106,37 @@ class TranslatorListBuilder extends DraggableListBuilder implements EntityListBu
+          'label' => $entity->label(),

Label is doubled here. You should write a hardcoded "Logo" here because the label is just output the column before.
In the Settings form it is OK.
Alternatively (better?) you could output "@provider Logo" and pick the provider plugin label.

miro_dietiker’s picture

Priority: Normal » Major
Issue tags: +Needs tests

Ah, also, as stated above, the test translator should declare a logo and we should check it.

And i'm promoting it since it has been requested so many times by providers.

miro_dietiker’s picture

Title: [meta] Add provider logo to settings » [meta] Add provider logo to settings and overview
edurenye’s picture

Did the proposed changes and added test.

Now looks like this:

The last submitted patch, 8: meta_add_provider-2713243-8-test_only.patch, failed testing.

edurenye’s picture

edurenye’s picture

miro_dietiker’s picture

+++ b/tmgmt_test/icons/tmgmt_test.svg

We could refer on any core svg instead of adding a custom one.

+++ b/src/Entity/ListBuilder/TranslatorListBuilder.php
@@ -105,13 +106,37 @@ class TranslatorListBuilder extends DraggableListBuilder implements EntityListBu
+          'label' => t('@provider logo', ['@provider' => $entity->label()]),

Preferrable, instead of the $entity label, output the plugin label.

Berdir’s picture

Status: Needs review » Needs work

@Miro: We enforce that the svg has to be within the module that provides the plugin. So we can't use one from core.

  1. +++ b/src/Entity/ListBuilder/TranslatorListBuilder.php
    @@ -80,7 +80,8 @@ class TranslatorListBuilder extends DraggableListBuilder implements EntityListBu
    +    $header['logo'] = t('Logo');
    

    What about, instead of naming this "Logo", we name this column "Provider" and fall back to just the label if nothing is provided?

    I guess the text only versions would be weird by default as they'd duplicate the text. So even without text fallback Provider as label might make more sense?

    Miro proposed no label at all, not sure about that. Could work if can combine the two columns together?

  2. +++ b/src/Entity/ListBuilder/TranslatorListBuilder.php
    @@ -105,13 +106,37 @@ class TranslatorListBuilder extends DraggableListBuilder implements EntityListBu
    +        '#type' => 'inline_template',
    +        '#template' => '<img class="tmgmt-logo-overview" src="{{ icon }}" title="{{ label }}" alt="{{ label }}"/>',
    +        '#context' => [
    +          'icon' => file_create_url(drupal_get_path('module', $definition['provider']) . $definition['logo']),
    

    Why not use #theme image for this?

  3. +++ b/src/Entity/ListBuilder/TranslatorListBuilder.php
    @@ -105,13 +106,37 @@ class TranslatorListBuilder extends DraggableListBuilder implements EntityListBu
    +          'label' => t('@provider logo', ['@provider' => $entity->label()]),
    

    Iagree with Miro that it should be the plugin label.

    Also, below you removed logo, I think that should also be done here?

  4. +++ b/tmgmt_test/src/Plugin/tmgmt/Translator/TestTranslator.php
    @@ -27,7 +27,8 @@ use Drupal\tmgmt\TranslatorRejectDataInterface;
    + *   logo = "/icons/tmgmt_test.svg",
    

    Leading / usually implies an absolute path, I think those things are usually specified without and the / is added in the code that adds it.

    theoretically, we could use the / to indicate an absolute path outside the module but I don't think that supporting the code for that is worth it, not if the only use case is the test plugin.

miro_dietiker’s picture

I like the proposal with "Provider" as heading in the plugin label column.
However, the image then should no more contain "logo" in the text for accessiblity reasons. It's simply the provider plugin name.

edurenye’s picture

Done as discussed.

johnchque’s picture

Issue summary: View changes
Status: Needs review » Needs work

It seems the icons are a bit off-center in the providers list. Should be one extra line in css.

johnchque’s picture

Issue summary: View changes
edurenye’s picture

Yes, you are right looks better now:

miro_dietiker’s picture

Status: Needs review » Needs work
Issue tags: -Needs tests

I think this looks great now and almost ready...

+++ b/src/Entity/ListBuilder/TranslatorListBuilder.php
@@ -105,13 +106,38 @@ class TranslatorListBuilder extends DraggableListBuilder implements EntityListBu
+        '#theme' => 'image',

+++ b/src/Form/TranslatorForm.php
@@ -150,6 +150,21 @@ class TranslatorForm extends EntityForm {
+          '#type' => 'inline_template',

Why once image and once an inline template?

edurenye’s picture

I forgot about that sorry.
Testing again manually I fixed other things, like add the slash now that we don't want it in the definition of the provider.
Also fixed the CSS, is not the best solution, as is not really how I would like it to behave, but the proper solution would be add something like the EQCSS, or maybe add this directly to core as this could be needed in a lot of places like #2696933: Content overflow issue, and also could make things cleaner and easier in a lot of places.

johnchque’s picture

Status: Needs review » Reviewed & tested by the community

I like this css approach, we should also consider open a core issue related with that #2696933: Content overflow issue

miro_dietiker’s picture

+++ b/css/tmgmt.admin.css
@@ -30,10 +30,10 @@
+  screen and (min-width: 1130px){

I can not believe we are unable to float it at 1024px full screen. I still do many screenshots for presentations at that resolution and i'm expecting a desktop look and not a mobile one at that size.

Berdir’s picture

Also, AFAIK we discussed showing it on the job checkout settings as well at some point? As a translation service provider, that's where I wanted my logo to be visible.. in a place that users will actually see when doing translations.

miro_dietiker’s picture

Status: Reviewed & tested by the community » Needs work

You are right that this makes sense to make it visible when working with the thing.
We completely forgot this location in the original issue scope definition.

edurenye’s picture

Added the new icon in the checkout form.
Also considering that in the settings box we can not know what is inside we agreed to move the logo outside, as we can control how it looks there.
And finally the icons looks good and are responsible.
Thanks @yongt9412 for the tips with CSS.

Here some screenshots:

miro_dietiker’s picture

Status: Needs review » Needs work

So!much!responsive! Awesome! ;-)
And yeah, we should recommend wide logos. The higher they are, the worse is the wrapping.

Hope we can commit this soon now, but..

+++ b/css/tmgmt.admin.css
@@ -27,6 +27,28 @@
+    float: right !important;
+    margin-top: -4.5em !important;

!important will create trouble and i almost can't believe it's needed here.

edurenye’s picture

You are right, it works without the !important.

Berdir’s picture

Status: Needs review » Fixed

Committed including all logos.

Berdir’s picture

Title: [meta] Add provider logo to settings and overview » Add provider logo to settings and overview

Now committed correctly. Also this wasn't really a meta, just had related issues. metas usually don't have a patch on their own.

  • Berdir committed 144f967 on 8.x-1.x authored by edurenye
    Issue #2713243 by edurenye: Add provider logo to settings and overview
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.