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

Prepare strict type for FieldStorageConfig::getCardinality()


Error while trying to create new page: The "" entity type does not exist.

$
0
0

I am getting an error when trying to add a new page. I have tried to run update script, cleared cache, and also tried running the composer again, but no luck. I am running Drupal 8.7.0 on PHP 7.2.14 on macOs

Here is the stack trace.

The website encountered an unexpected error. Please try again later.Drupal\Core\Entity\EntityStorageException: The "" entity type does not exist. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 847 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Drupal\Core\Entity\EntityTypeManager->getHandler(NULL, 'storage') (Line: 208)
Drupal\Core\Entity\EntityTypeManager->getStorage(NULL) (Line: 21)
Drupal\lingotek\Plugin\Field\FieldType\LingotekTranslationSourceField->computeValue() (Line: 34)
Drupal\lingotek\Plugin\Field\FieldType\LingotekTranslationSourceField->ensureComputedValue() (Line: 43)
Drupal\lingotek\Plugin\Field\FieldType\LingotekTranslationSourceField->getValue() (Line: 693)
Drupal\Core\Entity\ContentEntityBase->toArray() (Line: 650)
phoenix_lib_entity_postsave(Object)
call_user_func_array('phoenix_lib_entity_postsave', Array) (Line: 403)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_postsave', Array) (Line: 206)
Drupal\Core\Entity\EntityStorageBase->invokeHook('postsave', Object) (Line: 835)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('postsave', Object) (Line: 527)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, ) (Line: 720)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, ) (Line: 451)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 838)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 394)
Drupal\Core\Entity\EntityBase->save() (Line: 207)
Drupal\lingotek\LingotekConfigurationService->setProfile(Object, 'p', ) (Line: 473)
lingotek_form_content_entity_form_submit(Array, Object)
call_user_func_array('lingotek_form_content_entity_form_submit', Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 590)
Drupal\Core\Form\FormBuilder->processForm('node_pages_form', Array, Object) (Line: 319)
Drupal\Core\Form\FormBuilder->buildForm('node_pages_form', Object) (Line: 61)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object) (Line: 129)
Drupal\node\Controller\NodeController->add(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

[ignore] Patch Testing Only

$
0
0

IGNORE - PATCH TESTING ONLY - IGNORE

Field type image : need to add a default class to " img " element if Image style is set to " None (original image) "

$
0
0

Problem/Motivation

Default field template for image fields contains image name class, but no class when no class (original image) is displayed.

When using image style thumbnail:

<img property="schema:image" src="" width="100" height="42" alt="" typeof="foaf:Image" class="image-style-thumbnail">

When using None (original image):

<img property="schema:image" src="" width="100" height="42" alt="" typeof="foaf:Image" class="">

Proposed resolution

Add `image-style-none` class when image is displayed as original (no image style). This should be done in default field template file:

<img property="schema:image" src="" width="100" height="42" alt="" typeof="foaf:Image" class="image-style-none">

Remaining tasks

Submit the patch.

User interface changes

No UI change

API changes

New `image-style-none` CSS class exposed by default field templates.

Data model changes

No data changes.

\Drupal\error_test\Controller\ErrorTestController::generateWarnings() notice is not a notice in PHP 8

$
0
0

Problem/Motivation

In \Drupal\error_test\Controller\ErrorTestController::generateWarnings() we do

$bananas = [];
$monkey_love = $bananas[1];

To generate a notice - this produces a warning PHP 8.0.

Steps to reproduce

https://3v4l.org/2oaL1

Proposed resolution

Move to code that produces a notice in all situations.

$notice = new \stdClass();
$notice == 1 ? 1 : 0;

https://3v4l.org/r1WNq

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

None

Cannot use relationship for rendered entity on Views

$
0
0

Problem/Motivation

You cannot create a view and try to list rendered entities using relationship.

Steps to reproduce (based on Standard profile):

  1. Add an entity reference field named "field_content" to the "page" content type. Allow content > article references.
  2. Create and edit a content view.
  3. Add a relationship for "Content using field_content." or "Content referenced from field_content."
  4. The row style plugin is "Content" by default.
  5. Click on "Teaser" in order to change the view mode, nothing happens.
  6. You can't choose a view mode even if you don't want to actually use a relationship, just having one on your view triggers this.

The problem is a fatal AJAX error triggered when RowPluginBase::buildOptionsForm() calls RelationshipPluginBase::init() while providing a wrong argument type (Array instead of DisplayPluginBase).

Argument 2 passed to Drupal\views\Plugin\views\relationship\RelationshipPluginBase::init() must be an instance of Drupal\views\Plugin\views\display\DisplayPluginBase, array given, called in /app/web/core/modules/views/src/Plugin/views/row/RowPluginBase.php on line 93

Proposed resolution

Fix it, by passing along the relationship as needed and using it.

Remaining tasks

None.

User interface changes

None

API changes

None

 

Contributor tasks needed
TaskNovice task?Contributor instructionsComplete?
Create a patchInstructionsExtract the test code + yml file out of the patch in #26

Allow PostCSS Plugin “Px to Rem” in core for Olivero theme

$
0
0

Background

Thanks to the Claro theme, PostCSS is now in core (see #3060153: Use PostCSS in core, initially only for Claro).

During development of the Olivero theme, several additional PostCSS plugins have proved indispensable, and make the CSS much more readable and less likely to break.

I am creating separate core issues for each (these are offshoots of #3092499: Allow additional PostCSS Plugins in Core (for Olivero theme).

Goal of this issue

Get approval from maintainers to allow the user of the PostCSS PX to REM plugin within Drupal core.

Use case for PostCSS PX to REM

Within Olivero’s Proof of Concept, we are currently using the px units for spacing because this is easier to write and provides less of a mental overhead when visualizing the 10px vs 0.625rem.

However, relative units are needed for accessibility reasons. Within the user's OS or browser settings, you can adjust the font-size to be larger. PX units do not always respect this setting, therefore we use REM units.

Plugin overview

Fortunately, there's a very simple conversion to switch between the two. Assuming your HTML element's base font-size is 16px (which it is in Olivero, you simply divide the count of px by 16. So, 10px becomes 0.625rem.

Usage

The plugin is very simple, it runs a simple conversion to divide any pixel units by 16 (or the configured value) and output REM units in the distribution CSS.

Alternative

The alternative is to go through the CSS codebase and manually do all of the conversions.

This would undoubtedly increase cognitive load, and make development more difficult, as 10px is undoubtedly easier to understand than 0.625rem.

Popularity of postcss-pxtorem

PostCSS PX to REM has 998 stars on GitHub, is used by 17,300 projects, and has over 37,000 downloads per week via NPM.

Dependency evaluation

  • Maintainership of the package: latest commit on the repository was in 3 March 2020. Mainly maintained by a single person who seems to be still active. Last issue comment is on 12 June 2020 https://github.com/cuth/postcss-pxtorem/issues/59#issuecomment-643553970
  • License:MIT License
  • Security policies of the package: Not formally documented. This library is only used in by core developers in development environments.
  • Expected release and support cycles: undocumented; New major version has been coming out every 2-3 years.
  • Code quality: well documented, comprehensive tests.
  • Other dependencies it would add, if any: No additional runtime dependencies.

Timestamp field widget - "Leave blank to use the time of form submission." is inaccurate if field is required

$
0
0

I've found a confusing/inaccurate experience with Timestamp field widget when the field is required.

Steps to reproduce

Create a Timestamp field on a content type; set it to be required, with no default value.

When editing, I see:
edit date field

Expected
According to the help text - I can leave this field blank, and when I save the node, it will populate with the date/time at which I submitted.

Actual
I cannot leave this field blank - the HTML5 'required' attribute enforces populating it before form submit. If I remove that attribute with browser inspector, I can submit, but the form API marks the field with an error because the value was empty. Populating it with the current date/time does not happen, regardless.

Here, what the help text says seems to be incorrect.

Solution?
Enforcing the field to be required, as configured, makes sense. The current date/time default can still happen, when the node/add form is loaded. Perhaps in this case, the wording of the help text should be adjusted.


Replace content revision table with a view

$
0
0

Updated by #80

Problem/Motivation

Convert content revision table to view.

Proposed resolution

Replace the content revision table with a view.

Remaining tasks

  • Mulitlangual support see #77
  • "Strip HTML" filter/rewrite doesn't work on the log messages.
  • If we want to retain the yellowish rowstyle for the default revision, and the striped rowstyle in bartik, this might be solved in Twig or we could add a rowstyle plugin to views.
  • The dropbutton misalignment error, see #1890266: dropbutton text fails to retain .dropbutton-widget width

User interface changes

Before


After

API changes

N/A

Data model changes

N/A

Release notes snippet

WIP

Orignial Report

This depends on #1863898: Add test coverage for Views revision link handlers and #1826604: Add a dropbutton field handler to Views

This is one of the only content listings without it's own custom hook_ENTITY_operations().

Cannot save unpublished versions of published content for users without manage book privileges

$
0
0

In 8.4x and beyond , a new validation has been added for BookOutlines core/modules/book/src/Plugin/Validation/Constraint/BookOutlineConstraintValidator.php
The code in this validation plugin compares previous book values and new values and raises exceptions as needed.
When a user doesnt have permission to administer books and when a node is not part of any book, the entity variable doesnt have any book values and hence when trying to save unpublished versions of published content, the following error is being thrown

You can only change the book outline for the published version of this content.

This can be critical for content moderation when users are not allowed to manage books!

Steps to reproduce:

1. As a user without manage books privileges, create an article and publish it (If the user doesnt have publishing rights, publish it with an admin user).
2. Now edit the article as the first user again and try to save it in draft mode.

The node cannot be saved and the error regarding book outline is thrown

ViewsFormBase::getForm() re-uses $key and relies on odd PHP 7 behaviour

$
0
0

Problem/Motivation

\Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm() relies on very odd PHP behaviour that is fixed in PHP 8.

This is happening because of this behaviour change in PHP 8.0 - https://3v4l.org/TJ2cb

Steps to reproduce

if (isset($view->form_cache) && $view->form_cache['key'] != $key) {
to
if (isset($view->form_cache) && $view->form_cache['key'] !== $key) {
and run core/modules/views_ui/tests/src/Functional/FilterUITest.php

see https://dispatcher.drupalci.org/job/drupal_patches/63999/

Proposed resolution

Don't duplicate the use $key and change to !==

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Use RouteMatch instead of request attributes in book navigation block

$
0
0

Problem/Motivation

The proper way to retrieve an upcasted route parameter is via the RouteMatch. BookNavigationBlock and BookNavigationCacheContext attempt to achieve that by accessing the request attribute directly.

Proposed resolution

Use the proper method to access upcasted route parameter, i.e. the same code as BookBreadcrumbBuilder.

Remaining tasks

User interface changes

API changes

Data model changes

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue categoryBug
Issue priorityNot critical

[random test failure] Make QuickEditIntegrationTest more robust and fail proof

$
0
0

Problem/Motivation

working on #2948828: Layout Builder's Field Blocks do not work with Quick Edit I tried to extend QuickEditIntegrationTest to test Layout Builder with QuickEdit

This works if you only want to test a node 1 time but as soon as you go back to the same node as the same user in the same session the test fail randomly.

Proposed resolution

Can we fix the tests so they are more robust?

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Default all responses to 500 before any code is run so PHP will throw 500's on FATAL errors

$
0
0

Problem/Motivation

If PHP throws a FATAL error, a 200 response will be returned.

This could mean that the 200 'OK' response gets cached by a browser, a reverse proxy, or a CDN.

Proposed resolution

I was sure PHP could return a 500 is maybe display_errors were turned off, but from testing this wasn't happening for me.

If we set the status code to 500 in index.php, before any other code is run, we can ensure that PHP will return a 500 response code for FATAL errors. All other cases will be handled by a Response object, so will have the correct/intended status code

Remaining tasks

User interface changes

API changes

Data model changes

Viewing Layout Builder enable node fails after Workflow enabled on bundle if another node was created before enabling

$
0
0

Problem/Motivation

steps to reproduce

  1. install standard profile
  2. enable layout builder and content moderation
  3. enable layout builder on Basic page(don't need overrides)
  4. Create a Basic Page node
  5. Enable the "Editorial" workflow for Basic Page
  6. Create another Basic Page node
  7. Fail on saving

error

Drupal\Component\Plugin\Exception\ContextException: Assigned contexts were not satisfied: entity in Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping() (line 150 of core/lib/Drupal/Core/Plugin/Context/ContextHandler.php)

But the actual problem is in \Drupal\layout_builder\SectionComponent::getPlugin()

$plugin = $this->pluginManager()->createInstance($this->getPluginId(), $this->getConfiguration());

the id of the plugin will be extra_field_block:node:page:content_moderation_control and this will return and instance of \Drupal\Core\Block\Plugin\Block\Broken

Proposed resolution

Ensure that when there are new extra fields we clear the block cache.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet


Photos removed from file_usage table

$
0
0

I introduced several nodes of content with photo fields and uploaded photos linked to these nodes. A backup database shows the file_usage table in good order: the photos are indicated to be used by content nodes.

After activating the 4 modules from Drupal Core Multilingual and adding a new language (Dutch) at first sight all seemed well. After some time (hours) though all the photos that were uploaded before activating the multilingual modules disappeared. It seemed that those photos were not mentioned in the file_usage table anymore and therefore the photo files were - rightfully - removed from /sites/default/files. The root cause of this problem would therefore be that the entries for the photos were removed from the file_usage table

Recent comments title link missing URL fragment

$
0
0

Problem/Motivation

1. Installed Drupal 8.x-4.x
2. Create an article.
3. Posted some comments to the article.
4. Enable Recent comments block

Expected - the comment title link in the block should go to the comment fragment. /comment/123#comment-123
Actual - the comment title just points to /comment/123

Proposed resolution

Use the Permalink function instead of just add the fragment.

Apologies if this post isn't up to scratch, I can't recall the last time I logged an issue but I did read the issue posting guidelines, and I've searched the issues register for a related post. I've been using Drupal since version 4.x but I'm not a programmer, just a wannabe web site developer.

The "Recent Comments" view (block) is returning a link that doesn't not take the user to the comment anchor on the relevant node, as previously reported on the following Drupal pages:

https://www.drupal.org/node/2704123
https://www.drupal.org/node/2642260

(I've read those pages and I could see that a patch was developed and committed but I've only just upgraded to 8.30 and it's still affecting me)

So instead of the correct link:

/comment/51#comment-51

I get the following:

/comment/51

Which takes the user to the correct node but not to the comment itself.

I don't think I've customised this view (but if no-one else is reporting this then perhaps I have done something stupid and don't remember).

Site profile follows:

Web Server: Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.5.33
Database: MySQL 5.7.17

I'm manually migrating a site from 7.X to 8 and this is my only show stopper, any advice or assistance appreciated.

Comment counter shows 1 comment too many

$
0
0

The forum index shows the comment count as the actual comment count + 1 from the topic itself.
This is confusing (I think completely wrong) because the forum index shows there is 1 comment, while there is none, Or it shows 5 while there 4, and so on...

On the overview that contains the actual topic, the comment count is shown correctly. Which makes it even more confusing.

Attached is a patch that fixed this.

Notice: Undefined index: title in Drupal\update\ProjectSecurityRequirement

$
0
0

Problem/Motivation

I suddenly got this weird error after adding a new text field to a taxonomy. I thought it had something to do with cache, but clearing cache didn't help. I also deleted the field I had created, thinking that might be the cause, but the error is still there.

Something's getting mixed up with the Update module I guess. I have been working with this site for a while now and haven't seen this error before.

Tried Google but couldn't find anything helpful, so what might be the cause and the solution for this?

Here's what I got:

Notice: Undefined index: title in Drupal\update\ProjectSecurityRequirement::createFromProjectDataAndSecurityCoverageInfo() (line 103 of core/modules/update/src/ProjectSecurityRequirement.php).
Drupal\update\ProjectSecurityRequirement::createFromProjectDataAndSecurityCoverageInfo(Array, Array) (Line: 43)
update_requirements('runtime') (Line: 186)
update_page_top(Array) (Line: 336)
Drupal\Core\Render\MainContent\HtmlRenderer->buildPageTopAndBottom(Array) (Line: 135)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Proposed resolution

When fetching update data always clear the update_project_data from state as it has another cache of the available updates that needs refreshing with the new data.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

N/a

Settings tray UI issue on Safari with page zoom level > 100%

$
0
0

Problem/Motivation

On Safari with page zoom level more than 100%, the settings tray jumps to the left. The issue happens with the settings tray of Layout Builder and Webform. It however does not occur when page zoom level < 100%.

Steps to reproduce

* Safari 13.1.2 (15609.3.5.1.3)
* Safari 14.0 (15610.1.28.1.9, 15610) on Catalina 10.15.7
* Safari Technology Preview Release 114 (Safari 14.1, WebKit 15611.1.1.3 on Catalina 10.15.7
* Drupal 8.7.11 with theme Seven
* Drupal 8.8.10 with theme Seven
* Drupal 8.9.7 with both theme Seven and Claro

(see attached screenshots)



Viewing all 292077 articles
Browse latest View live


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