Quantcast
Channel: Issues for Drupal core
Viewing all 292343 articles
Browse latest View live

[meta] Ensure compatibility of Drupal 9 with PHP 8.1 (as it evolves)

$
0
0

Problem/Motivation

Make sure Drupal 9 keeps being compatible with PHP 8.1. Work with dependencies as needed. See #3109885: [meta] Ensure compatibility of Drupal 9 with PHP 8.0 (as it evolves) for how we did it with PHP 8.0. PHP 8.1-alpha1 is now released, see https://www.php.net/archive/2021.php#2021-06-10-1

Proposed resolution

Figure out what breaks. Itemize and resolve one by one.

1. Dependency updates to support PHP 8

To produce a list of dependencies that are blocking PHP 8.1 support, you can do the following. Make sure you use PHP 8 to run it.

$ git clone --branch 9.3.x https://git.drupalcode.org/project/drupal.git whynotphp81
$ cd whynotphp81/
$ composer install
$ composer update
$ composer why-not php:8.1

List of upstream updates in progress

List of upstream dependencies that are likely to lack PHP 8.1 support

Upstream fixes that are merged but need a release:

2. Internal Drupal issues

List of issues TBD

DONE

TBD

Release notes snippet

TBD


Better documentation for the admin_permissions key

$
0
0

I want to try to write a paragraph or two to clarify the purpose of the admin_permissions key in the @ContentEntityType annotation. I don't know if this is adequately documented anywhere.

The only language I can find in a documentation page at drupal.org is this...

The admin_permission key automatically allows all access for users with that permission. In case more logic is required, a custom access controller can be specified.

However, this language needs to be fleshed out and made more specific. What is "access" in this context?

Please comment if there is already some good documentation somewhere. I will use this issue to make notes as I determine how this admin_permission value affects other access control like EntityAccessControlHandler.

Here are a couple documentation pages that have code examples with the admin_permission key but need some language explaining its purpose:
https://www.drupal.org/docs/8/api/entity-api/structure-of-an-entity-anno...
https://www.drupal.org/docs/8/api/entity-api/creating-a-content-entity-t...

An old discussion that gave rise to the admin_permissions key: https://www.drupal.org/project/drupal/issues/2105557

Add configuration allowing administrative lists of books to be sorted alphabetically

$
0
0

Problem/Motivation

Steps to reproduce

Proposed resolution

Problem/Motivation

Across the site, Books are listed in the order they were created, with no other sort options. (This is about the books themselves, not pages within a book.) I'd like to present more sort options for books.

This affects the list of books on /admin/structure/books, the node creation Book dropdowns, and the Book Navigation block when it appears on all pages.

Here is a compilation of screenshots from a fresh installation of 8.6.x, with ten books. I've included the books' weight in their titles. You can see they are listed in the order they were created (click to see full size):
Examples of how the book lists are currently sorted.

This is fine on small sites, but for large sites, it's terribly unwieldy. Trying to locate a specific book is hard when the list is long, because it's not sorted in a meaningful way.

Steps to Reproduce:

  • Enable the book module.
  • Create two or more books: Content > Add Content > Book Page > 'Outline' tab > Create a new Book, select a random weight value as well.
  • Visit /admin/structure/books to see that your books are sorted by creation date.
  • Create a sub-page in one of your books: Content > Add Content > Book Page > 'Outline' tab > Select one of your books. Notice that your books are sorted by creation date in the dropdown.
  • Structure > Block layout > Add a Book navigation block to your sidebar, using the default settings. In the resulting block, your books are once again sorted by creation date.
  • TO TEST MY PATCH: Apply the patch, then go to /admin/structure/books/settings and select a sort order (alpha or weight). Observe that books in all the previous locations have been rearranged to match your selected sort.

Proposed resolution

On my large site, I'd like to sort the books alphabetically by their titles.

In #2828681: Book Navigation Block does not sort Books by weight, @mtnguru wanted to sort the Book Navigation block by book weight.

The patch I'm proposing expands upon that, by allowing both weight and alpha sort, in all lists of books (not just the Book Navigation block).

I've added the ability to sort by either alpha or weight; weight is the default sort.
I've added a new Book config setting that remembers which sort the site builder wants. My initial patch includes the new config, the updated settings form, and the new sort methods.

I chose to implement the sorts in BookManager.php's getAllBooks() function, since that is the source of all of these unsorted lists. I'm unfamiliar with the Book module's code, so if there is a better place for this, I'm all ears!

Here are screenshots of the end result (click to see full size):

New settings option on /admin/structure/book/settings:
New sort selection radio buttons for Books.

Based on the selected setting, I get either an alpha sort or a weight sort across all lists:
Examples of the books being sorted alphabetically.
Examples of the books being sorted by weight.

Remaining tasks

  • Reviews needed
    • Are there other places that Books get listed that I've missed?
    • Any changes to the verbiage presented to users on the settings page? It probably needs clarification.
  • Needs upgrade path
  • Tests need to be written.

Data model changes

I added a new Book configuration option. Shouldn't interfere with any previous config, though.

Display node title by default when creating link with drupalink, allow configuration.

$
0
0

By default, if you do not select text and use the drupal link wysiwyg plugin, it creates a link with the url as the title. It would be more useful if the link created used the title of the node for the link, and even better if you could customize this in a hook.

[ignore] Patch Testing Only

Fix 'Drupal.Commenting.ClassComment.Missing' coding standard

$
0
0

Problem/Motivation

This sniff relates to Drupal API documentation standards for classes and namespaces.

Hello this fixes the Drupal.Commenting.ClassComment.Missing standard listed in this parent, #2571965: [meta] Fix coding standards in core.

In the pull request two classes are skipped:
- one is being fixed via the https://www.drupal.org/project/drupal/issues/3105880
- and another one intentionally doesn't include the class doc block due to testing the empty plugin annotations (therefore the adjusted phpcs.xml.dist).

Steps to reproduce

Proposed resolution

Remaining tasks

Review
Commit

User interface changes

API changes

Data model changes

Release notes snippet

Remove usage of setAccessible() when core requires PHP 8.1

$
0
0

Problem/Motivation

Since PHP 8.1 setAccessible() method is no-op
https://github.com/php/php-src/blob/php-8.1.0beta1/UPGRADING#L486-L490
It's widely used in tests

Steps to reproduce

visit
- https://github.com/php/php-src/blob/php-8.1.0beta1/ext/reflection/php_re...
- https://github.com/php/php-src/blob/php-8.1.0beta1/ext/reflection/php_re...

Proposed resolution

Clean-up usage of the method when core require PHP 8.1

Remaining tasks

- agree and patch
- commit

User interface changes

no

API changes

no

Data model changes

no

Release notes snippet

Usage of ReflectionProperty::setAccessible() and ReflectionMethod::setAccessible() is removed

Allow usage of WYSIWYG in maintenance message

$
0
0

Problem/Motivation

When creating a custom message for the maintenance page, you can use HTML at /admin/config/development/maintenance. The purpose of this issue is to enable the WYSIWYG editor on this page.

User interface changes

Before:
Before

Expected after:
After

Impacts

  1. Update the system.schema and the corresponding system.maintenace configuration.
  2. Add hook_update_N() for this.
  3. Update MaintenanceForm to allow WYSIWYG.
  4. Update the message display in Maintenance page to let the message value being displayed.
  5. Update tests
  6. Update translation tests
  7. Update update process (from D6/D7 to D8)
  8. Update the update process tests.

Data model changes

Before message is now a text_format instead of text in system.schema.yml, the system.maintenance.yml is impacted. message key is now an array of value / format.

Before:

message: '@site is currently under maintenance. We should be back shortly. Thank you for your patience.'
langcode: en

After:

message:
  value: '@site is currently under maintenance. We should be back shortly. Thank you for your patience.'
  format: plain_text
langcode: en

Make StylePluginBase::renderFields public

$
0
0

API page: https://api.drupal.org/api/drupal/core%21modules%21views%21src%21Plugin%...

I would suggest to make StylePluginBase::renderFields(array $hresult) public instead of protected.

The module Views Merge Rows is a display extender plugin that modify Views output by implementing hook_views_pre_render(). As the module needs to access $view->style_plugin->rendered_fields during pre-rendering process, and because $view->style_plugin->rendered_fields is not rendered prior to the execution ofhook_views_pre_render, invoking $view->style_plugin->renderFields($view->result) is made necessary.

The access in the code is as follows:

$view->style_plugin->renderFields($view->result);
$rendered_fields = $view->style_plugin->getRenderedFields();

Prior to the proposed solution, creating a derived class of StylePluginBase was considered. However, the required property would not spread throughout all style plugins. The latter is pre-requisite because Views Merge Rows is a display extender intended to work with any style plugin.

User login flood lock doesn't clear when reset password as admin

$
0
0

Problem/Motivation

#992540: Nothing clears the "5 failed login attempts" security message when a user resets their own password clears the user login flood lock when user try to reset password. However, it doesn't work for admin resets user password.

Steps to reproduce

  1. Register as a normal user
  2. Try to login with wrong password for 5 times
  3. Login as admin and change user's password
  4. Try to login as user with new password

Expected
Allow user to login with new password.

Expected
- Still getting "There have been more than 5 failed login attempts for this account. It is temporarily blocked. Try again later or request a new password."

Proposed resolution

Dispatch an event on password reset to clear flood lock.

Remaining tasks

- One scenario current patch doesn't work - When admin reset the password and new password == old password.

"Unsaved changes" message incorrectly appears on layout builder

$
0
0

Problem/Motivation

The "You have unsaved changes" message sometimes appears on layout builder pages, even when no changes have been made.

Steps to reproduce

  1. Enable layout builder for a content type, and allow each content item to have its layout customized.
  2. Create a node.
  3. Click the "Layout" tab.
  4. Refresh the page.

Actual result: "You have unsaved changes" message appears.
Expected result: The message should not appear, since there are no unsaved changes.

I believe this bug was introduced by https://www.drupal.org/commitlog/commit/2/9c7b7f7be26a1b9179010851e68004... .

Installing the syslog module uses its configuration before it is written

$
0
0

Problem/Motivation

While testing Drupal 8 on PHP 8.1 #3220021: [meta] Ensure compatibility of Drupal 9 with PHP 8.1 (as it evolves) it was discovered that \Drupal\syslog\Logger\SysLog is instantiated before it is written. This because we call \Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions(); before writing the config from syslog/config/install.

Steps to reproduce

Proposed resolution

Options:

  1. Bail early in \Drupal\syslog\Logger\SysLog::log() if $this->config->get('format') returns NULL.
  2. Provide hardcoded defaults in \Drupal\syslog\Logger\SysLog::log()
  3. add a config listener and update the config when it is written
  4. Decouple completely from config and fix #3103620: Dependency on config storage causes circular reference in service container too

In #3220021: [meta] Ensure compatibility of Drupal 9 with PHP 8.1 (as it evolves) I initially implemented option 3. This had the advantage of making it possible for syslog to log its own installation - i.e. the log message at the end of \Drupal\Core\Extension\ModuleInstaller::install(). One problem with this approach is that kernel tests with syslog still fail because config is often not installed with them.

Option 2 means that we'd have to keep the defaults across \Drupal\syslog\Logger\SysLog and config/install/syslog.settings.yml aligned. Also if you are doing a config import to install the syslog module and you've changed the config it'll use the wrong settings until the config kicked in.

Option 4 will involve way more way work and change the constructor and still has to grapple with when and which config to use to provide defaults.

Given the above option 1 is the simplest solution.

Remaining tasks

User interface changes

N/a

API changes

N/a

Data model changes

N/a

Release notes snippet

Olivero should style Views exposed filters as inline (currently are stacked)

$
0
0

Olivero's currently stacks Views exposed filters. Other themes inline them. We should do the same.

Layout builder filter leaves blank space

$
0
0

Problem/Motivation

The filtering works fine but when links are hidden the li tags have padding and/or border that stays behind thus taking up space.

Proposed resolution

Hide the parent li

Reverting entity revisions that contain custom blocks erroneously triggers EntityChangedConstraint

$
0
0

Blocked behind #3053887: Add test coverage and document why inline blocks require a new revision to be created when modified, regardless of whether a new revision of the parent has been created

Problem/Motivation

When reverting a parent entity revision, the parent/child relationship looks like:

 +------------+   +------------+   +------------+
 |Host Entity |   |Host Entity |   |Revert VID 1|
 |VID: 1      |   |VID: 2      |   |VID: 3      |
 |Timestamp: 1|   |Timestamp: 2|   |Timestamp: 3|
 +------------+   +------------+   +------------+
       |                |                |
       v                v                |
 +------------+   +------------+         |
 |Block Entity|   |Block Entity|         |
 |VID: 1      |   |VID: 2      |         |
 |Timestamp: 1|   |Timestamp: 2|         |
 +------------+   +------------+         |
       ^                                 |
       +---------------------------------+

 Custom block entity form
 +-----------------------------+
 |$saved_entity change time: 2 |
 |$new_entity change time: 1   |
 |Validator throws error       |
 +-----------------------------+

When block entity VID 1 is loaded into the custom block form, the validator compares it against VID 2 as the "saved entity". The validator sees that a new revision has been created since VID 1 and throws an error.

Node handles this by updating the changed timestamp in \Drupal\node\Form\NodeRevisionRevertForm::submitForm when a node is reverted, but there isn't currently a process to create new entity revisions of custom blocks when a host entity is reverted.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Add a setting to make description a required field for file items

$
0
0

Problem/Motivation

A site builder is able to allow the user to enter a description for the file field upload. However, in some circumstances, the description may be mandatory. Right now there's no way for a site builder to make the file field upload description mandatory.

Proposed resolution

Add a new setting for file items to require the file description.

Remaining tasks

N/A

User interface changes

A new file field setting that allows to enforce the description.

Site builder perspective

End-user perspective

API changes

None.

Data model changes

New, description_field_required, boolean key in the mapping of code>field.field_settings.file schema.

Release notes snippet

As a site builder, on a file field settings form, after checking Enable Description field, check the Require the Description field setting in order to make the file upload required.

Original report

If I add a file field and check Description, I don't get the option to make Description a required field. This results in the public seeing often-unfriendly file names instead of a meaningful description.

Steps: As admin:
1. Edit basic page
2. Add new file field

Actual result: Description is not prechecked
Expected result: Optionally, Description is pre-checked as the public-friendliest solution

3. Check Description

Actual result: No option to require description appears
Expected result: Check box to require description appears. Optionally, it is pre-checked as the public-friendliest solution.

As editor:
1. Add new basic page
2. Attach file
3. Don't fill in Description field
4. Save and publish

Actual result: No error
Expected result: Error

[PHP bug] Illegal length modifier specified 'f' in s[np]printf call on rename() in MTimeProtectedFastFileStorage

$
0
0

Hi,

I am getting a error when I am clearing a cache or opening module page it's happening on live server not in localhost

Error -

Fatal error: Illegal length modifier specified 'f' in s[np]printf call in /core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php on line 88

Toolbar style update

$
0
0

(Originally submitted by saschaeggi on Github)

Problem/Motivation

Recent interviews and research exposed pain points around Drupal's admin experience of looking and feeling dated.

Proposed resolution

Implement new Toolbar design to create a favorable first impression of Drupal for evaluators and a better user experience for site authors. No functional differences.

Specification

Quick overview

This image is just a quick overview for Navigation list specs. Please use the Figma link to full specification as the main resource for specs.

toolbar

Full specification

FIGMA: https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Design-system?node-id=3324%3A0

This link is anchored to the board with the full specification. As an anonymous user you can see the design, but to actually be able to pick colors and sizes please login on Figma.

Remaining tasks

      Update patch styling to include time inputs
      Create a Merge Request or reroll the patch based on [#73].
      Integrate feedback from [#74] and #75: Where is book log message? (can be done together with previous step) and move to the issue status to Needs review.
      To start the reviews, take screenshots of the results.

    User interface changes

    No functional differences.

    Test Pages

    /admin/

    Claro Shortcuts star fails WCAG Use of Color and Non-text contrast

    $
    0
    0

    Problem

    The shortcuts star icon doesn't satisfy WCAG Success Criteria 1.4.1 "Use of Color", or 1.4.11 "Non-text contrast".

    • The grey outline of the star is too faint. It has a contrast ratio of just 2.78:1 against the grey page background.
    • The yellow fill isn't sufficiently distinguishable from the transparent fill. The contrast between the yellow and the grey page background is 1.29:1.
    • The yellow-fill is the only indication of state. On it's own, it isn't a reliable signifier. Even if these did have good contrast in the full-colour situation, the state can still be difficult for some users to notice: users with a colour vision impairment, or other visual impairments, or who have adjusted the colour space in some way, or where the screen is overpowered by ambient light.
    • When a Windows high-contrast theme is used, the star remains the same colour. We cannot rely on either the grey outline or the yellow fill to be distinguishable from the page background, because we cannot know what the background colour will be.
    • The Star is missing entirely in IE 11 when a Windows High Contrast theme is used. It's a CSS background image, and it gets stripped out by the browser. Users cannot perceive, operate, or understand it; they likely won't know it's there at all.

    Contextual Links Style Update

    $
    0
    0

    Originally submitted on Github

    Problem/Motivation

    The admin UI theme is being redesigned and Contextual links need to be integrated with the new design system.

    Proposed resolution

    Specs to follow for the contextual link icon: https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Drupal-Design-system...
    The contextual links should not be styled as they are currently shown in the figma link. Instead, for consistency, the styling should match the existing dropbutton tray styling.

    Remaining tasks

    Testing instructions

      Enable Claro and set as the admin theme
    • If the profile used is Umami, access any existing content like /recipes/watercress-soup.
    • If the profile is Standard, go to the homepage and hover the "No front page content has been created yet." message.
    • Contextual links should be styled by Claro in the default theme, even if that default theme isn't Claro
    Viewing all 292343 articles
    Browse latest View live