Problem/Motivation

Follow-up from #3425080: Add a UI option to change or hide the logo on the Toolbar and split from #3436526-68: Adjust custom navigation logo dimensions on upload.

The navigation module allows you to upload a custom image for the logo, then stores the file ID.

This means that the change can only be made on production, and the site owner would then need to sync both database and files to a development environment to be able to export configuration.

The theme logo configuration also allows you to upload an image which will be stored as a managed file, but it stores the path to the image instead and has an option to manually specify the image path. This means that site owners would be able to configure this directly on a development site (even if it points to a managed file uploaded on production) without a full file sync installed.

It would also make it possible for people to use SVGs committed to their code base for the navigation icon.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Screenshot of the new interface

API changes

Data model changes

Release notes snippet

Issue fork drupal-3462829

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

catch created an issue. See original summary.

catch’s picture

Marked #3468672: Allow SVG logos duplicate since this issue would enable svg logos to be used.

pooja_sharma made their first commit to this issue’s fork.

pooja_sharma’s picture

Assigned: Unassigned » pooja_sharma

pooja_sharma’s picture

Assigned: pooja_sharma » Unassigned
Status: Active » Needs review

Implemented code to support image path instead of file id of navigation logo, also made some adjustments to the respective code files for the new changes. apart form nothing seems to be left.

Please review , moving NR.

smustgrave’s picture

Status: Needs review » Needs work

Left comments on MR.

pooja_sharma’s picture

Assigned: Unassigned » pooja_sharma

Thanks for reviewing , working on the it.

pooja_sharma’s picture

Assigned: pooja_sharma » Unassigned
Status: Needs work » Needs review

Addressed the feedback, left comment on MR. PLease review, moving NR.

smustgrave’s picture

Status: Needs review » Needs work
smustgrave’s picture

Added additional comments

pooja_sharma’s picture

Status: Needs work » Needs review

Addressed the feedback, left comment on MR. PLease review, moving NR.

smustgrave’s picture

Will leave for somewhere else but -1 from me as we are hard coding values and schema validation appears to be missing.

pooja_sharma’s picture

Assigned: Unassigned » pooja_sharma
Status: Needs review » Needs work

On adding validation constraints appears random test failures , moving to NW 'll debug it.

pooja_sharma’s picture

hard coding values of logo extension now added in config & added constraints validation as well

As new key logo_extension added, it leads to 'validation config' warning: https://git.drupalcode.org/issue/drupal-3462829/-/jobs/2613092

But not getting similar warning on local even try with this command: drush config:inspect --filter-keys=navigation.settings --detail --list-constraints

it 'll be great if anyone can share suggestion for it.

-                "navigation.settings": 4,
+                "navigation.settings": 5,
                 "node.settings": 2,
                 "node.type.*": 22,
                 "olivero.settings": 16,
@@ -2788,10 +2788,10 @@
         },
         "perPropertyPath": {
             "all": {
-                "count": 17140
+                "count": 17141
             },
             "validatable": {
-                "count": 10377
+                "count": 10379
             },
             "fullyValidatable": {
                 "count": -1
pooja_sharma’s picture

Assigned: pooja_sharma » Unassigned
Status: Needs work » Needs review

Tried to address the mentioned feedback, apart form it nothing appears to be left.

MR is mergeable, there is one warning validation config, it display validation count & line no. increase which is correct, no any error message displaying here, not sure on the basis of it, PLease review, moving to NR.

kumudb’s picture

There is an issue occurring when clicking on the entity used for the logo from the file system.

1. Upload a custom logo:
Navigate to Administration > Configuration > User Interface > Navigation > Settings.
Upload and save your custom logo.

2. Save the configuration:
Ensure the changes are saved properly.

3. Verify the issue:
Go to Administration > Content > Files.
Locate your most recently uploaded logo file.
Click on the Usage link for this file.
Observe the error that appears.

The website encountered an unexpected error. Try again later.

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "logo" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 138 of core/lib/Drupal/Core/Entity/EntityTypeManager.php).

pooja_sharma’s picture

@kumudb, This issue not replicate due to these MR changes , I have verified & created issue here, can track there.

smustgrave’s picture

Will leave for additional reviews

But my thoughts
But logo_managed variable name for a path doesn't make much sense to me
Logo_extensions seems to have no field (is there not a way to get allowed file uploads?)
The schema for logo_managed says it's allowed to be null but if it's a path to an image then should validate it's a valid path.

pooja_sharma’s picture

But logo_managed variable name for a path doesn't make much sense to me

Agree , 'll working on the same, keep logo_path variable name.

Logo_extensions seems to have no field (is there not a way to get allowed file uploads?)

Generally when we upload the image on the node form , there is only visible image field, & image extension not visible to the user , it is attached with field storage.

Here if we 'll add logo_extension field then on the same form logo extension & logo upload field both 'll be visible, this 'll be bit confusing experience for the user.

The schema for logo_managed says it's allowed to be null but if it's a path to an image then should validate it's a valid path.

On the basis of my understanding trying to rply correct me if I 'm missing anything, 'logo_managed' can be null because at the BE there are three opts available:
default: (by default this value is selected when this selected then image path not get from the config, so image path not store as well, due to which I set null) ,
hide: in this opt no image 'll display & not store it's value in config,
custom logo update: only in this opt image store in config form.

so on the basis above mentioned scenarios keep it null as it's not mandatory that always there 'll be value in this image field , if there is not value in the image field at that time how 'll I validate image path (this is something I can't figure out)

plopesc made their first commit to this issue’s fork.

plopesc’s picture

Status: Needs review » Needs work

Thank you for the work on this one!

Once #3436526: Adjust custom navigation logo dimensions on upload has been merged, the ground for this one is ready.

Merged main into the MR branch and solved the conflicts as best as I could. Also added some new comments.

Wonder if the aim of this one would be to have a similar UI and logic we already have for the theme logo, but that could be discussed later.

pooja_sharma’s picture

Assigned: Unassigned » pooja_sharma
pooja_sharma’s picture

Assigned: pooja_sharma » Unassigned
Status: Needs work » Needs review

Applied suggestions on MR & fixed test failures as well now MR is meregeable.

PLease review, moving NR.

plopesc’s picture

Status: Needs review » Needs work

Thank you for your help here @pooja_sharma.

According the Issue Summary, the expected outcome of this issue is to have a similar UI and behavior to /admin/appearance/settings page, where the logo path can be defined manually, or uploading a custom file, whose path is stored in config.

The difference with Logo image is that logic to adjust the file dimensions on upload should still be there.

plopesc’s picture

marc.bau’s picture

The difference with Logo image is that logic to adjust the file dimensions on upload should still be there.

Please also do not forget that uploading SVG files must be forbidden where setting a path to a SVG file need to be allowed.

m4olivei’s picture

I've closed #3471768: Page break error display :The "logo" entity type does not exist as a duplicate of this issue, since we'll resolve that here.

Let's credit: pooja_sharma, kumudb, skaught, plopesc, and smustgrave for review / patches when we have a commit here please.

plopesc’s picture

Status: Needs work » Needs review

Created a new MR for this one where the approach is more similar to /admin/appearance/settings.

Site administrator can enter a path or upload an image whose path will be automatically used.

plopesc’s picture

Issue summary: View changes
StatusFileSize
new56.74 KB

Attaching screenshot of the new Navigation settings UI.

plopesc’s picture

skaught changed the visibility of the branch 3462829-store-the-file to hidden.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new3.6 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

plopesc’s picture

Status: Needs work » Needs review

MR updated to solve the PHPStan and PHPCS errors after #3461318: Enforce return types in all new methods and functions

penyaskito’s picture

Added some questions to the MR, but don't think it should block this anyway.

plopesc’s picture

Thank you for your review @penyaskito.

Made some adjustments in the MR according to your comments.

penyaskito’s picture

Status: Needs review » Reviewed & tested by the community

Makes sense then!

RTBCing.

catch’s picture

Issue summary: View changes

One open question on the MR, and two others I answered myself as I was asking them, otherwise looks good.

Updating the issue summary to embed the screenshot.

plopesc’s picture

Thank you for the review and summary update.

Answered the outstanding question.

catch’s picture

Status: Reviewed & tested by the community » Needs work

OK now I understand why it's there I think I've got an alternative suggestion which looks like it would be easier?

plopesc’s picture

Status: Needs work » Needs review

Thank you for your review @catch.

Made a refactor of the validation and error handling logic. Hope it is good to go now.

  • catch committed 69af4bff on 11.x
    Issue #3462829 by pooja_sharma, plopesc, catch, smustgrave, penyaskito,...
catch’s picture

Version: 11.x-dev » 10.4.x-dev
Status: Needs review » Reviewed & tested by the community

That looks better thank you!

Committed/pushed to 11.x, thanks!

I was going to cherry-pick this to 10.4.x but it doesn't apply, which suggests another change has gone into navigation 11.x which didn't get backported. Rather than rebasing this, I think we should instead try to backport that issue instead so this cherry-picks cleanly (or decide we only commit things to 11.x, but one or the other).

catch’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

  • catch committed a4835bc8 on 10.4.x
    Issue #3462829 by pooja_sharma, plopesc, catch, smustgrave, penyaskito,...
catch’s picture

Status: Patch (to be ported) » Fixed

Did the cherry-pick to 10.4.x. The php baseline change didn't apply, after regenerating the baseline I discovered there were no baseline changes on 10.4.x at all, so just committed without it.

Status: Fixed » Closed (fixed)

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