Problem/Motivation

The problem is in olivero_preprocess_node. The code overwrites $variables['date'] with just a date. Previously the value was set by template_preprocess_node() and it contains rendered field output.

  1. This leads to missing classes, therefore custom styling might be missed
  2. For the same reason, custom features might not work (e.g. quickedit)
  3. If a site had customised the field display settings using a hook this would be overwritten

Steps to reproduce

  1. Enable quickedit
  2. Enable "Display author and date information" for a content type
  3. Edit a node of that content type

Proposed resolution

There is a clear requirement to customise the date format for a particular theme. However the current solution is probably not the right way to do it. Ideas:

  1. Alter the settings on the field formatter for the created field. Then it would get render correctly by the code in template_preprocess_node. However field formatter settings are not theme specific, so this would have a global effect.
  2. Hook into the pre-processing and alter the date format.

Remaining tasks

  1. Write a patch
  2. Re-enable commented out code in NodeDisplayConfigurableTest.php

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3215220

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

AdamPS created an issue. See original summary.

adamps’s picture

Issue summary: View changes
mohit.bansal623’s picture

Status: Active » Needs review

Can't we remove that piece of code which is formatting the date in olivero_preprocess_node.

Or we need to show that formatted date along with Quickedit working.

adamps’s picture

This code is displaying the date with a particular format 'olivero_medium'.

Maybe a better way to do that is to alter the settings on the field formatter for the created field. Then it would get render correctly by the code in template_preprocess_node.

mohit.bansal623’s picture

What is the requirement ?

To enable quickedit with the current date format the olivero theme is using

mohit.bansal623’s picture

We can create a custom field formatter despite of making changes in preprocess node as that is also blocking quickedit.

Please review.

mitthukumawat’s picture

StatusFileSize
new37.58 KB
new37.58 KB

@mohit.bansal623
The idea above seems working fine.
After removing the dateFormatter from olivero_preprocess_node, the quickedit is able to update the date fields options as well.
By the way, I don't think it is necessary to update the node created field at all. As the node created and updated values in database are useful in case of tracking information of any nodes. Instead, after updating the node, the node created date could be replaced with node updated date.
Apart from above, if it is fine, the changes in merge request fixed this issue. Adding screenshot for reference.

marcusvsouza’s picture

Issue summary: View changes
StatusFileSize
new50.4 KB

The commit in comment #6 works as expected, as the attached image shows.

manojithape’s picture

Assigned: Unassigned » manojithape
manojithape’s picture

Assigned: manojithape » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new42.83 KB
new42.6 KB

Verified and tested patch#6 MR !705 i.e. https://git.drupalcode.org/project/drupal/-/merge_requests/705.patch on the drupal 9.3.x-dev version and Olivero 9.3.0-dev version. Patch applied successfully and looks good to me.

Testing Steps:

  1. Install drupal 9.3.x-dev version.
  2. Go to Appearance -> Set Olivero theme as admin and default theme
  3. Enable quick-edit
  4. Enable "Display author and date information" for a basic page content type
  5. Open any basic page content type node
  6. Click on the quick edit option and observe the administrator user is not able to change/edit the node date.
  7. Now apply the patch and clear the catche.
  8. Again open the same basic page content type and click on the quick edit option.
  9. Verify administrator user is able to change/edit the node date using the quick edit option

Testing Results:

After applying the patch administrator user is able to change/edit the node date using the quick edit option.
Please refer attached Before patch sc and After patch sc images for reference.

Moving this ticket to RTBC.

gauravvvv’s picture

After saving changes of quick edit on the date field, the date field disappears after the patch.

Adding screen recording for reference.

manojithape’s picture

StatusFileSize
new1.06 MB

@Gauravmahlawat : The issue which you mentioned in comment #12 not reproducible on my machine. I tested the same on Drupal 9.3.x-dev version. After saving changes of quick edit on the date field, that changes displayed and date field also displayed.
For reference, I attached a screen recording.
Please share the drupal version, so I can try to reproduce on that version.

gauravvvv’s picture

@manojithape, I am using D9.3 on Chrome Version 90.0.4430.93 (Official Build) (x86_64)

alexpott’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs subsystem maintainer review

This code exists for a reason - and maybe the implementation is not correct but we should check with the Olivero maintainer before removing code.

mherchel’s picture

Priority: Normal » Minor
Status: Needs review » Needs work
Issue tags: -Needs subsystem maintainer review
StatusFileSize
new146.59 KB

This code exists for a reason

Yep! The code changes the date format for nodes. We need to ensure that this doesn't regress in any patches.

mherchel’s picture

Note that Quickedit will be deprecated. See #3222947: Decide whether to move Quick Edit to contrib. We'll want to move any changes into their own stylesheet, so we can easily remove them if necessary.

xjm’s picture

Issue tags: +quickedit

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

adamps’s picture

Title: Quickedit not working for node date » Field wrappers and customisations not working for node date
Priority: Minor » Normal
Issue summary: View changes

Updated the IS - I believe this is not only about quickedit.

adamps’s picture

Without this, there aren't really any core themes available to test the node date field. This would be a problem, except that the testing (that I spent some time writing) seems to have been deleted from Core anyway see #3342700: Reinstate important testing NodeDisplayConfigurableTest - great work.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

quietone’s picture

Status: Needs work » Postponed

The Olivero theme was approved for removal in #3590816: [policy, no patch] Deprecate Olivero and move to contrib.

This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

The deprecation work is in #3595082: [meta] Tasks to deprecate the Olivero theme and the removal work in #3595085: [meta] Tasks to remove the Olivero theme.

quietone’s picture

Project: Drupal core » Olivero
Version: main » 2.0.0
Component: Olivero theme » Code
Status: Postponed » Needs work
quietone’s picture

Version: 2.0.0 » 2.x-dev