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

[PP-1] Add "Add content" link to empty table text at admin/content


Introduce node_mass_delete() or make node_mass_update() more flexible

$
0
0

Follow up for #1498674: Refactor node properties to multilingual

Problem/Motivation

Simplify code

In 1498674 was the @todo

   // @todo Introduce node_mass_delete() or make node_mass_update() more flexible.

On the line in the patch in comment #303:
2850

The line of the final patch might change but that info might help to find them.

For example,

function node_user_predelete($account) {
   // Delete nodes (current revisions).
   // @todo Introduce node_mass_delete() or make node_mass_update() more flexible.
-  $nodes = db_select('node', 'n')
+  $nodes = db_select('node_field_data', 'n')
+    ->distinct()
     ->fields('n', array('nid'))
     ->condition('uid', $account->uid)
     ->execute()
     ->fetchCol();
   node_delete_multiple($nodes);
   // Delete old revisions.
-  $revisions = db_query('SELECT vid FROM {node_revision} WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol();
+  $revisions = db_query('SELECT DISTINCT vid FROM {node_field_revision} WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol();
   foreach ($revisions as $revision) {
     node_revision_delete($revision);
   }

Proposed resolution

Introduce node_mass_delete() or make node_mass_update() more flexible.

Remaining Tasks

  • use git blame to identify the issue that added this @todo and link to it, and link it back to here.

User interface changes

No.

API changes

maybe

Preview does not work if the "node add" form isn't at its canonical URL

$
0
0

Problem/Motivation

We are using the Group module in one of our client projects. From it's project page:

The Group module allows you to create arbitrary collections of your content and users on your site and grant access control permissions on those collections

The module introduces some entities:

  • Group
  • Group content - This is used to relate a node or a user with the Group.

A node can be created as a part of the group and the URI to create node is at:

/group/{group_id}/content/create/group_node:{content_type}

It shows up the same node create form. However, the preview button has to be hidden in the module as it doesn't work well with the workflow of the module. Check #2853001: Node previews don't work when adding group node

Same happens when editing content, with empty field on clicking "Preview" and going back to the canonical node edit form.

This brings the question: What if the node add/edit form is hosted on a different Route/URL other than the canonical one? Wouldn't preview work at all?

Proposed resolution

Use Symfony\Component\HttpFoundation\RequestStack to get the referer of the previous page from the HTTP request headers on Drupal\node\Form\NodePreviewForm and redirect the user to that when clicked on "Back to content editing". This mostly affects the new nodes.

Remaining tasks

Test and review the patch.

User interface changes

None.

API changes

None.

Data model changes

None.

ConfirmFormInterface::getFormName() serves no purpose in ConfirmFormBase

$
0
0

Problem/Motivation

ConfirmFormInterface::getFormName() is only called by ConfirmFormBase. The return value, a string, is used to build a hidden form element:

    $form[$this->getFormName()] = ['#type' => 'hidden', '#value' => 1];

The form value is not used by ConfirmFormBase's submit handler, although one subclass in core, UserMultipleCancelConfirm does check it.

However, because this form element uses the #value property, its value will ALWAYS be 1 according to the docs for Drupal\Core\Render\Element\Hidden:

 * - #value: The value of the form element. The Form API ensures that this
 *   value remains unchanged by the browser.

Therefore, AFAICT it doesn't serve any purpose and both the element and the ConfirmFormInterface::getFormName() could be deprecated.

Steps to reproduce

Proposed resolution

Remaining tasks

- Remove ConfirmFormInterface::getFormName().
- Deprecate implementations in core form classes. See how to deprecate for what needs to be done to add the deprecation.
- Remove the calls to getFormName() in core form classes.

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Improve Password Field Arrangement on User Profile Page

$
0
0

Problem/Motivation

When users update their password on the profile page, they must first enter their current password at the top. However, the new password fields are located below the email field. This placement can be confusing, especially since the labels for the new password fields only say "Password" and "Confirm password" without clarifying that they are for setting a new password.

Steps to reproduce

1. Log in as a user.
2. Navigate to the profile edit page.
3. Locate the password fields:
- The Current password field appears at the top.
- The password and Confirm password fields are placed below the email and username fields.
4. Notice that the new password fields are not clearly grouped with the current password field, leading to possible confusion.

Proposed resolution

Rearrange the password fields for better clarity and user experience:

1. Current password:
||||||||||||||||||||||||||||

2. New password:
||||||||||||||||||||||||||||

3. Confirm new password:
||||||||||||||||||||||||||||

This structure ensures users clearly understand the required steps for changing their password.

"Delete" action is shown as text and not link for Views-generated link in a menu

$
0
0

Problem/Motivation

On Drupal 10.4.4, when viewing the links of a menu, I noticed that the "Delete" action in Operations dropbutton is shown as text and not as link for a Views-generated link I had. As far as I understand, I cannot delete that link from the Menu page but only from the View, so having this action as text seems to be a bug.

The Views-generated link "Delete" action:
Views-generated link "Delete" action

The manually-added link "Delete" action for comparison:
Manually-added link "Delete" action

Steps to reproduce

  • Create a View Page and add it to a Menu as "Normal menu entry".
  • Go to that Menu's edit page /admin/structure/menu/manage/[menu_name].
  • Click the Operations dropbutton and navigate to "Delete".

Proposed resolution

Unfortunately I don't have one.

Add pager option 'Reverse page order'

$
0
0

Hi

As you know page numbers is like 1 2 3 4 ...
And when 10 nodes added and if the page limit is 10 then the page numbers stay as they are and the nodes move from one page to the other.

to avoid this i tried to create the page numbers like : 45 44 43 42 .... instead of 1 2 3 4 .... if we have 45 pages. This way when new nodes are added the ones on the last page will have still the same page number. Of course i am talking about a view with tons of nodes and where the nodes are ordered by descending creation time.

There are mainly 2 reasons why i try to reverse the page numbers:

1- users memorise the page numbers, and after some time when they come back, all the nodes are moved to other pages since lots of nodes are added.

2- google bot and other bots memorises the page numbers, and when it comes back it sees that all pages with the same url have different pages, and thinks that it should reindex reindex reindex.... keep indexing. and when displaying result to its' users bots always point to a wrong page. And this i believe drops the page rank of the site.

I wonder if anyone can help me to reverse the page numbers.

thank you
arda

Use Drupal Core Leadership terminology in MAINTAINERS.txt


Exposed Filter in Views Redirects to Page Display Path Instead of Block Path

$
0
0

Problem/Motivation

When creating a view in Drupal with an exposed filter, and then embedding this view as a block on a specific page, the user is redirected to the page display path of the view when applying the filter, instead of staying on the same page where the block is embedded.

Steps to reproduce

Install Drupal 10.3.1 with the standard profile.
Add a new "Test view" view with default settings (Show: Content of type: All, etc.).
Click "Save and edit".
Add a new filter for Content type and enable the "Expose this filter to visitors, to allow them to change it" option. Save the settings.
Add a new Block display to the view.
Add a new Page display to the view.
Set the path for the Page display to "test-view".
Save the view.
Create a new "Basic page" node with the title "Test page" and the URL alias "Test". Save the node.
Navigate to Structure > Block layout and click "Place block" in the Content region.
Find the "Test view" block and click "Place block".
In the Visibility section, go to the Pages tab and enter "/test". Save the block.
Open the "/test" URL and observe the page with the injected view block containing the exposed Content type filter.
Select any value from the Content type dropdown and press Apply.

Expected Behavior:
The user remains on the same page, and the view block updates to show the filtered results.

Actual Behavior:
The user is redirected to the "/test-view" URL, the path set for the view page display, causing confusion and navigation issues.

Allow defaulting toolbar tray to vertical orientation with configuration

Decouple identifier management from database Connection, introduce an IdentifierHandler class

$
0
0

Problem/Motivation

Database identifiers resolution has grown recently, with escaping, caching and introduction of the square brackets syntax to resolve the problem of generic SQL statements to be ported across platforms using different quoting characters. This on top of the concept of prefixing tables.

All this has been added on the Connection class that is IMHO a bit overdoing.

Also, some platforms are hitting identifier length issues like e.g. #571548: Identifiers longer than 63 characters are truncated, causing Views to break on Postgres.

Proposed resolution

Decouple identifier management, including prefix management, in a class of its own, that platforms can override to manage their own restrictions.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Add a #disable_inline_form_errors_summary property to disable the Inline Form Errors summary

$
0
0

Problem/Motivation

In certain cases we want to disable duplicate messages (on top - summary - and inline).
We currently have the #error_no_message property which allowed us to disable errors messages for individual elements.

There may be some field that does not display the inline error, so the message is only visible in the summary. As an example, the Captcha field.
We should then keep the messages in the summary - even when the new property to disable the summary is requested - for fields that contain errors but can't display them inline (Eg. invisible elements, missing elements, ...).

Proposed resolution

Add a form property which can be used to disable IFE summary$form['#disable_inline_form_errors_summary'] = TRUE.
Keep the message in the summary for fields which can't show inline-error (Eg. invisible elements, missing elements, ...).

Completed tasks

Remaining tasks

User interface changes

  • Developers will be able to remove the Summary message when IFE is enable.
  • The summary should still be visible for an element which can't show inline-error (invisible element, missing element, ...).

API changes

The form element will have an optional #disable_inline_form_errors_summary boolean, that if TRUE, disables the duplicate messages from summary & inline-error elements. If one or more elements with errors can't show inline-error (Eg. invisible elements, missing elements, ...) , the summary will remain visible with those messages only.

Summary generated with AI on April 20, 2023

Note that this summary has not yet been validated by a human.

The issue is about adding a possibility to disable the Inline Form Errors summary. This is useful in cases where you want to show only the inline errors, but not the summary with links to them. For example, this could be useful for AJAX forms, where you don't want the big red box at the top of the page.

The proposed solution is to add a new property to the form element, called #disable_inline_form_errors_summary. This property can be set to TRUE to disable the summary.

The patch has been written and tested, and it is ready to be merged.

The next steps are to update the issue summary and to get the patch merged.

getCreatedTime returns string instead of integer

$
0
0

Problem/Motivation

The phpdocs of getCreatedTime mention that the timestamp will be returned as integer. While it is currently returning a string.
This leads to bugs when you do strict comparison with the changed time which is correctly returning an integer.

Steps to reproduce

if ($comment->getCreatedTime() !== $comment->getChangedTime()) {
  // Statement is always true
}

Proposed resolution

Convert the value to int, just like all other timestamp methods.

Recursively replace placeholders in CachedStrategy

$
0
0

Problem/Motivation

Found in #3512762-10: Optimize placeholder retrieval from cache. Placeholder strategies operate in a response event, not at every level of a render array. This means that if a placeholder is cached and has placeholders nested inside it, these aren't caught by CachedStrategy and can still fall back to bigpipe (which will then eventually retrieve them from cache via the normal render cache).

However, we should be able to recursively retrieve the placeholders from cache within CachedStrategy.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Claro primary tabs collapsed menu hamburger icon has insufficient contrast with forced-colors dark background

$
0
0

Problem/Motivation

In forced-colors emulation on Firefox MacOS, the "hamburger" menu icon for the collapsed primary tabs (menu local tasks) does not adjust color.

On a dark background, the blue icon has insufficient contrast.

Screenshot of Claro primary tabs menu hamburger icon in forced-colors mode

I'd guess that this also applies to WHCM, but that needs confirmation.

Steps to reproduce

  1. In the Firefox Configuration Editor, change browser.display.document_color_use to 2.
  2. In the Firefox color settings, change colors to get dark background, light text, and yellow links, with "Override" set to "Always".
    screenshot of Firefox color settings
  3. With Claro as the admin theme, go to /admin/content.
  4. Reduce the window size until the primary tabs collapse into a menu with the hamburger icon.

Like the table sort icons, the color of the hamburger icon should match the color of links:

Screenshot of Claro primary tabs menu hamburger icon in forced-colors mode

Proposed resolution

  1. Change the icon to a background image.
  2. In a media query for forced-colors: active, use the CSS mask-image property with linktext background color.

For example, the table sort direction indicator:

  @media (forced-colors: active) {
    background: linktext;
    mask-image: url(../../images/icons/003ecc/sort--asc.svg);
  }

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet


Preload cache tags in cache getMultiple

$
0
0

Problem/Motivation

#3436146: Introduce a list of "frequent cache tags" to reduce lookup query amount adds preloading for cache tags.

I think we can make use of this in the cache backend itself, to preload tags when multiple cache items are requested at once.

This doesn't kick in very often with core performance tests but it's visible in the Umami authenticated test.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Convert '_none' option to a constant, deprecate form_select_options(), deprecate form_get_options() for removal, move form_select_options() to a new class.

$
0
0

Problem/Motivation

The string '_none' is repeated throughout the module and tests, using a constant makes it easier to refactor.

Steps to reproduce

NA

Proposed resolution

  1. Convert _none to a constant.
  2. Move form_select_options() to a helper class.
  3. Deprecate form_get_options() for removal.

Remaining tasks

- Review
- Commit

User interface changes

API changes

String '_none' is converted to constant.
form_select_options() is moved as class method in \Drupal\Core\Form\FormOptionsHelper
form_get_options() is deprecated for removal

Data model changes

NA

Release notes snippet

NA

Add cache invalidation performance test

Optimize placeholder retrieval from cache

$
0
0

Problem/Motivation

In #3437499: Use placeholdering for more blocks and on Slack we (@berdir, @catch and myself) did some digging and came to the conclusion that the single cache lookups of placeholders no longer makes sense in Renderer. We now have a ::getMultiple() method on the render cache and we know we're going to look all of the placeholders up in one go in CachedStrategy.

So why don't we skip the retrieving of placeholders in Renderer altogether and allow CachedStrategy to do that? The ones we didn't find will still end up getting rendered live, but at least this way we went to the cache once instead of for every placeholder individually.

Steps to reproduce

N/A, check metrics after the change

Proposed resolution

Skip single placeholder cache GETs and offload to getMultiple()

Remaining tasks

Investigate and discuss potential fall-out from moving this bit around

User interface changes

N/A

Introduced terminology

For discussion in this issue:

PRC
PlaceholderingRenderCache
VC
VariationCache

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

Inappropriate error when updating a field schema with existing data

$
0
0

Problem/Motivation

When attempting to update a field's cardinality programmatically using the `EntityDefinitionUpdateManager`, an error occurs if the field is stored as a property in the entity table, but the update attempts to move the field to a dedicated field table.

The error message is as follows:

<strong>TypeError: array_intersect_key(): Argument #1 ($array) must be of type array, null given in array_intersect_key()</strong> (line 2479 of /core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php)

Steps to reproduce

  1. Install a fresh Drupal core with the Node module enabled.
  2. Create content using the "Node" entity type, and ensure the "Title" field has data stored as a property in the entity table.
  3. Create a custom module with the following hook or equivalent programmatic update (the code below)
  4. Run the update or execute the programmatic code to update the field storage definition.
  5. Observe the error.
<?php

   use Drupal\Core\Field\FieldStorageDefinitionInterface;

   /**
    * Implements hook_update_N().
    */
   function mymodule_update_9001() {
     // Update definitions and schema.
     /** @var \Drupal\Core\Entity\EntityDefinitionUpdateManager $manager */
     $manager = \Drupal::entityDefinitionUpdateManager();

     /** @var \Drupal\Core\Field\BaseFieldDefinition $definition */
     $definition = $manager->getFieldStorageDefinition('title', 'node');
     // Change cardinality to trigger the schema transition.
     $definition->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
     $manager->updateFieldStorageDefinition($definition);
   }

Proposed resolution

  1. Add a check in `SqlContentEntityStorageSchema::hasColumnChanges()` to identify schema transitions where a field moves from being stored as a property in the entity table to a dedicated field table.
    This check will correctly detect schema transitions and allow the system to throw a meaningful exception instead of a generic error.
  2. Ensure that when such a schema transition is detected, the system throws a `FieldStorageDefinitionUpdateForbiddenException` with a clear message, such as:
    The SQL storage cannot change the schema for an existing field (title in node entity) with data.

We get this error because in the hasColumnChanges method, the $this->getSchemaFromStorageDefinition($storage_definition) call passes a new BaseFieldDefinition object. During verification in the requiresDedicatedTableStorage method, this returns TRUE. As a result, the getDedicatedTableSchema method is invoked, which returns the schema for a dedicated table for the corresponding field when it does not have a table.

Due to this, in the following code (see screenshot Xdebug - initialized variables.png):

foreach ($this->loadFieldSchemaData($original) as $table => $table_schema) {
  foreach ($table_schema['fields'] as $name => $spec) {
    $definition_spec = array_intersect_key($definition_schema[$table]['fields'][$name], $keys);
    $stored_spec = array_intersect_key($spec, $keys);
    if ($definition_spec != $stored_spec) {
      return TRUE;
    }
  }
}

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Viewing all 297003 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>