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

Fix the rest of PHPStan level 0 errors

$
0
0

Problem/Motivation

Follow-up to #3178534: Start running PHPStan on Drupal core (level 0). We want all of the Drupal core to be checked against PHPStan level 0.

Proposed resolution

Try to fix as many level 0 problems as possible in this issue.

Remaining tasks

Run phpstan level 0 on core and create a merge request to address problems.


Mobile menu top border problem in high contrast mode

$
0
0

Problem/Motivation

The tops of the mobile menu doesn't look right in high contrast mode. IE and Firefox both lose 1/2 of the toggle, but it's a different part depending on the browser.
Firefox

IE11

This is probably due to the top positioning of the mobile menu being implemented via a thick border, and high-contrast modes treat borders and backgrounds differently.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

LayoutBuilderIsActiveCacheContext not providing correct context value.

$
0
0

Problem/Motivation

layout_builder_is_active cache context implemented in \Drupal\layout_builder\Cache\LayoutBuilderIsActiveCacheContext does not seem to be providing the correct cache context value - it is always 0. Issues seem to be:

  • getContext() calls getDisplay(). getDisplay()checks whether the entity parameter from the route is an instance of OverridesSectionStorageInterface. AFAICT, OverridesSectionStorageInterface is not implemented by any entity classes; it's just the interface for the overrides section storage plugin. In which case, getDisplay() always returns NULL.
  • Docblock for getDisplay() says the method should return \Drupal\layout_builder\Entity\LayoutEntityDisplayInterface, but even assuming there is an entity implementing OverridesSectionStorageInterface, getDefaultSectionStorage() returns \Drupal\layout_builder\DefaultsSectionStorageInterface, not \Drupal\layout_builder\Entity\LayoutEntityDisplayInterface
  • Class docblock says that the cache context is to be used to "Determines whether Layout Builder is active for a given entity type or not.", but it seems the intent of the code is to determine whether a specific entity has layout builder overrides enabled.
  • There isn't any test coverage for this cache context.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Add "edit blocks" and "create blocks" permissions

$
0
0

Problem/Motivation

This issue follows up on the discussion in #1975064: Add more granular block permissions

Custom blocks can be created as structural page elements and content editors might need to edit their content on a production site. For example, a block with opening times placed on the front page: Editors should not be able to move it, but might need to change it to add special opening times.

Currently, users need "Administer blocks" permissions to do such a purely content change that doesn't even change the configuration. However, this also gives them the permission to change the whole block layout, remove or delete blocks etc.

#1975064: Add more granular block permissions discusses more granular block permissions in general, but just adding a separate permission to edit existing custom blocks would already be a big improvement for user experience for content editors and for sitebuilders setting up the sites for such roles.

larowlan and Tim Plunket in #98 proposed to also add a "create blocks" permission as part of this issue because that would be useful for Layout builder.

Proposed resolution

Add an edit block permission per block type.

Provide an easy way for users with the new permission to reach the block-edit form.

Completed tasks

  • Write a patch.
  • Update the patch as requested in Comment #32 (numbered points). (done by #50)
  • Add tests. (done by #56 & #58)
  • Create an issue to fix the early return in BlockContentAccessHandlerTest::providerTestAccess() (done by #3022183).
  • Write a change notice.
  • Make updates as discussed in #94 - #96.
  • Make sure that users with permission to edit a block can use the edit (contextual) link when the block is viewed. (confirmed via manual testing)
  • UI tests for edit/create permissions

Remaining tasks

  • Allow users with the create $type block content permission to create blocks via /block/add route as per #106
  • Review and commit.

User interface changes

  • Users with the new permission will be able to use the edit links on the "front end" of the site.

API changes

TBD.

Layout Builder overrides section storage sets local tasks block cache max-age to 0 on content entity pages without overrides enabled

$
0
0

Problem/Motivation

\Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage provides local tasks for relevant entity types.

When viewing an entity of one of those types (let's just say node for simplicity), if overrides aren't enabled for the display for that node, as the links for the local tasks are built, the access for the layout_builder.overrides.node.view link has max-age 0. This max-age is applied to the local task block render array.

The reason this is happening is that as the local tasks are build, access to each link is checked via \Drupal\Core\Access\AccessManager::checkNamedRoute(). In that method, the parameters for the the layout_builder.overrides.node.view are upcasted, but since there is no overrides section storage for the entity, \Drupal\layout_builder\Routing\LayoutTempstoreParamConverter returns NULL for the section storage parameter, causing
\Drupal\Core\ParamConverter\ParamConverterManager::convert() to throw. ParamNotConvertedException
The exception is handled by the access manager by denying accessing and making the access object cache max-age 0.

Since the local tasks block will vary by permissions and by each page anyway, making the block uncacheable is probably not wrong. However, it would affect page/response cacheability in #2352009: [pp-3] Bubbling of elements' max-age to the page's headers and the page cache.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Breadcrumb in IE11 adds unnecessary horizontal scrollbar

$
0
0

Problem/Motivation

Since IE11 needs to be supported until Drupal 10 at the earliest... (I know 🙁)
IE11 adds a horizontal scroll for breadcrumbs where it's clearly not needed

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Standardize Olivero's focus states across all controls

$
0
0

During the Drupal Accessibility Office Hour (18 Jun 2020) we reviewed the focus styles as they currently stand in Olivero.

Video recording of the focus style walk-through. https://www.youtube.com/watch?v=tZQMBdbv-x8

Note that the demo used Firefox. If you play with these in a different browser, you will see different user-agent default styles.

We need to standardize focus states across most hyperlinks.

* Focus states do not need to be tied to hover states
* Focus states should be 4 sided
* Focus states should work in high contrast mode (no box shadow, backgrounds, etc).

Add error checking to config import create operation

$
0
0

Problem/Motivation

I run a multisite on Drupal 8.9.11. On one of my sites, I recently started having the error described at https://www.drupal.org/forum/support/post-installation/2019-07-31/error-..., where a config import would error out with the following error:

[error] Error: Call to a member function delete() on null in Drupal\Core\Config\ConfigImporter->checkOp() (line 902 of /var/www/html/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php) #0 /var/www/html/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(609): Drupal\Core\Config\ConfigImporter->checkOp('', 'create', 'system.menu.dev...')
#1 /var/www/html/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(514): Drupal\Core\Config\ConfigImporter->processConfigurations(Array)
#2 /var/www/html/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(333): Drupal\Core\Config\ConfigImporter->doSyncStep('processConfigur...', Array)
#3 /var/www/html/vendor/drush/drush/includes/drush.inc(206): Drush\Drupal\Commands\config\ConfigImportCommands->doImport(Object(Drupal\Core\Config\StorageComparer))
#4 /var/www/html/vendor/drush/drush/includes/drush.inc(197): drush_call_user_func_array(Array, Array)
#5 /var/www/html/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(304): drush_op(Array, Object(Drupal\Core\Config\StorageComparer))
#6 [internal function]: Drush\Drupal\Commands\config\ConfigImportCommands->import(NULL, Array)
#7 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#8 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#9 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#10 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(302): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/vendor/symfony/console/Application.php(1005): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/html/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(49): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#18 /var/www/html/vendor/drush/drush/includes/preflight.inc(18): require('/var/www/html/v...')
#19 phar:///usr/local/bin/drush/bin/drush.php(143): drush_main()
#20 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#21 {main}.

This only happens in my local and dev environments, and only one this one site. Copying the database from production or stage into the dev or local environments doesn't resolve the issue. Clearing the cache doesn't resolve the issue. Because I use Configuration Split to install different modules and change settings of other modules in certain environments, I checked the configuration between the site having the issue and my "default" site. Both matched exactly.

Proposed resolution

At https://www.drupal.org/forum/support/post-installation/2019-07-31/error-..., the resolution is to replace the code under the create operation of the switch statement in the checkOp function in core/lib/Drupal/Core/Config/ConfigImporter.php with code included in the forum post. However, the forum post assumes that $entity already has a value. If it doesn't, and the target config entity exists, $entity should be assigned that value and the operation should execute as expected. Otherwise, if it doesn't exist, it shouldn't execute the delete operation to avoid erroring out unnecessarily.

Hopefully I've described the issue adequately. I'd be happy to check other areas of my configuration, database, etc. if needed to ensure this is actually an issue needing correction and not just something wrong with my site.


Keyword search in Views Table leads to "website encountered an error" screen

$
0
0

I have created a View in Table format of a custom content type, displayed as a Page, and I've exposed the Search filter to allow keyword searching. The first unexpected thing about it is the filter displays on the page without my having to go to Place Block on the Blocks admin page. The other, more serious issue, is that when I perform a keyword search I get a "The website has encountered an error. Please try again later" error page. This error gets logged:

Uncaught PHP Exception Drupal\\Core\\Database\\DatabaseExceptionWrapper: "Exception in Database listing[database_listing]: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'library.node__field_resource_title.field_resource_title_value' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by: SELECT node_field_data.langcode AS node_field_data_langcode, node_field_data.nid AS nid, SUM(node_search_index.score * search_total.count) AS score, MIN(node_field_data.nid) AS nid_1\nFROM \n{node_field_data} node_field_data\nLEFT JOIN {search_index} node_search_index ON node_field_data.nid = node_search_index.sid AND (node_search_index.type = 'node_search' AND node_search_index.langcode = node_field_data.langcode)\nLEFT JOIN {search_total} search_total ON node_search_index.word = search_total.word\nINNER JOIN {search_dataset} node_search_dataset ON node_search_index.sid = node_search_dataset.sid AND (node_search_index.type = node_search_dataset.type AND node_search_index.langcode = node_search_dataset.langcode)\nLEFT JOIN {node__field_resource_title} node__field_resource_title ON node_field_data.nid = node__field_resource_title.entity_id AND node__field_resource_title.deleted = :views_join_condition_0\nWHERE (node_field_data.status = :db_condition_placeholder_1) AND (node_field_data.type IN (:db_condition_placeholder_2)) AND ((node_search_index.type = :db_condition_placeholder_3) AND (node_search_dataset.data LIKE :db_condition_placeholder_4 ESCAPE '\\\\') AND (node_search_index.word = :db_condition_placeholder_5))\nGROUP BY node_search_index.sid, node_field_data_langcode, node_field_data.nid\nHAVING (COUNT(*) >= :node_search_index_keys)\nORDER BY node__field_resource_title.field_resource_title_value ASC; Array\n(\n [:db_condition_placeholder_1] => 1\n [:db_condition_placeholder_2] => databases\n [:db_condition_placeholder_3] => node_search\n [:db_condition_placeholder_4] => % archival %\n [:db_condition_placeholder_5] => archival\n [:node_search_index_keys] => 1\n [:views_join_condition_0] => 0\n)\n" at [webroot]/core/modules/views/src/Plugin/views/query/Sql.php line 1489, referer: my-page-URL

I'm not certain this has been reported elsewhere; apologies if I've duplicated another issue.

UID base field override configs can still have old default value callbacks

$
0
0

After upgrading from Drupal 8.9 to Drupal 9.0 I get the two following error/warning messages when trying to create new content using some (not all) of my content types, among them the native “page”-type:

Error message:

The website encountered an unexpected error. Please try again later. Error: Call to a member function getAccountName() on null in Drupal\node\NodeForm->form() (line 155 of core/modules/node/src/NodeForm.php).

Warning message:

call_user_func() expects parameter 1 to be a valid callback, class 'Drupal\node\Entity\Node' does not have a method 'getCurrentUserId' in Drupal\Core\Field\FieldConfigBase->getDefaultValue() (line 397 of core/lib/Drupal/Core/Field/FieldConfigBase.php).

Does anyone know what causes this?

Menu causes page load times of 40 - 50 seconds

$
0
0

Problem/Motivation

Currently redesigning the menu of a website, initially, it loaded up to a depth of 1. The website loaded perfectly normal.

But the new redesign requires we load all depth (So far I have seen it go far as 8th level) - The menu tree table has over 4400+ menu items.
Now page load time is in the region of 40-50 seconds (per page!)

After refreshing the page, the load time goes down to 1-2 seconds obviously due to the cache, however the website has new pages being created daily, so we can't rely on the drupal to cache the page AFTER its spent almost a minute to load the page.

As a temporary solution, the server specs had to beefed up (6 times what it was previously) just to handle the load request.

Steps to reproduce

Create 4000+ items
Place menu in existing region
- set depth to 8 or 9
load page as anonymous user

Proposed resolution

Any way the load time can be reduced whilst retaining the new design?
It seems the default drupal menu block is cached globally, but sadly breaks on each page load as it needs to add active classes to active menu items.

Translate tab is showing even though content translation permission not set for role

$
0
0

In a multilingual site I set content access to enable translation for Basic page and another content type called "Club".
Permissions for "Translate Basic page content" are set for administrator only.
I need an editor to be able to translate content type "club" so I set permission for editor to "Translate Club content".

Now I am facing two problems:
1. If I do not set the "Create translations" permission for editor, there is no local task for "Translate" when editor views a "Club" node.
2. If I do set the "Create translations" permission for editor, there is a local task for "Translate" and all works fine but this "Translate" local task is also showing on other content types (which are not configured for editor translations).
When editor clicks on "Translate" for other content types (like Basic page) he gets the translation table but not edit or add option i.e you cannot really translate.

Steps to reproduce:

  • Enable translation for 2 content types
  • Create a role and give permission to translate 1 of them. Give the user permission to create/edit/delete translations
  • When using that role visit a node of the other content type where you do not have translation permission.
  • You will now see a translation tab there even if you don't have permission to translate into that entity. When you click on the translation tab you will see all translations listed, but you cannot perform any actions.

Export configuration YAML strings as multiline

$
0
0

Problem/Motivation

Some configuration values are multiline (mails, system.maintenance & etc) but their export contains "\r\n" to split lines.
That makes configuration merging hard for such strings and mostly impossible to use configuration translations management for big config objects (for example webforms #2836206: Translation of big webforms broken)

Proposed resolution

Beautify export and make diff/merge tools less painful
http://symfony.com/doc/3.1/components/yaml.html#dumping-multi-line-liter...

Remaining tasks

agree on approach
patch, commit

User interface changes

No

API changes

TBD

Data model changes

All config files that have multiline strings will be updated on next export

Switch to entity owner in EntityContentBase during validation

$
0
0

Problem/Motivation

I opened #3134245: Run drush imports as user=1 to solve part of the problem. But that solution is very much a sledgehammer solution when perhaps a more valid solution is to just switch the user if entity validation is enabled. This does the latter.

Proposed resolution

Switch to the entity owner if it implements EntityOwnerInterface

Test the latest patch by enabling validation on the destination entity i.e. validate: true.

source:
  plugin: d7_node
  node_type: page
process:
  title: title
  type: type
  body: body
destination:
  plugin: 'entity:node'
  validate: true

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

MigrateExecutable should catch not only exceptions, but also fatal errors

$
0
0

Problem/Motivation

I discovered this while working on #3166602: Ensure media_filter → media_embed mapping does not cause fatal errors and subsequently #3166930: Migrated filters may have invalid/incomplete settings applied.

If a fatal PHP error occurs in the middle of a migration, it leaves the migration in a weird state:

  1. the message of the fatal error is not logged into the Migration system's messages tables, but only in the PHP error log and into watchdog
  2. the migration is left in the \Drupal\migrate\Plugin\MigrationInterface::STATUS_IMPORTING state
  3. therefore the migration is effectively "stuck", and you need to manually unstuck it

Steps to reproduce

See the STR in #3166930: Migrated filters may have invalid/incomplete settings applied.

Proposed resolution

Set a custom exception handler while in MigrateExecutable, because these are currently caught by _drupal_exception_handler(), so surely the migration system can do the same, but provide extra context?

  1. In PHP 7, fatal errors can be caught! So let's catch them, and treat them like exceptions. See https://www.php.net/manual/en/language.errors.php7.php→ see #2👀
  2. We currently only have
      /**
       * Migration error.
       */
      const MESSAGE_ERROR = 1;
    
      /**
       * Migration warning.
       */
      const MESSAGE_WARNING = 2;
    
      /**
       * Migration notice.
       */
      const MESSAGE_NOTICE = 3;
    
      /**
       * Migration info.
       */
      const MESSAGE_INFORMATIONAL = 4;
    

    Also add MESSAGE_FATAL_ERROR so that it's possible to communicate this is even worse than MESSAGE_ERROR. → see #3👀

Remaining tasks

  • Update issue summary (Novice).
  • Add tests.

User interface changes

Fatal errors also show up.

API changes

Addition: \Drupal\migrate\Plugin\MigrationInterface:MESSAGE_FATAL_ERROR.

Data model changes

None.

Release notes snippet

Fatal errors while running a migration no longer cause the migration system to crash.


[META] Start running PHPStan on Drupal core (level 0)

Migrate Drupal 7 date field "todate" value

$
0
0

Problem/Motivation

The Drupal 7 date module allowed the site builder to configure whether to collect an end date or not:

(This is called 'todate' in the code.)

For example, on my personal site, I have a projectNodeType which has a "time range"date. Example: https://wimleers.com/work/project/ledgrid.

Upon migration, the start value (value) is migrated, but the end value (value2) is dropped

D7

D8 HEAD

That's because this is being migrated to a @FieldType=datetime field in D8 instead of a @FieldType=daterange field in D8!

Proposed resolution

Make \Drupal\datetime\Plugin\migrate\field\DateField detect the todate setting and:

  1. expand the process chain to also transform data for @FieldType=daterangeend_value property, instead of only the value property
  2. dynamically override the statically computed destination field type: return daterange instead of datetime when appropriate
  3. most simple, but perhaps most controversial: change the destination_module key in the @MigrateField annotation to datetime_range instead of datetime. The migration system seems to not have been designed for dynamic conditional edge cases like this one, and the harm of requiring that module to be installed even if unused is minimal; and certainly does not outweigh the data loss that is currently happening.

Remaining tasks

  • Fix failing tests.
  • Add a new test (and provide a test-only patch).

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

TBD

Error in image_styles of image.module on database update

$
0
0

Error on running database update script:
warning: array_merge() [function.array-merge]: Argument #1 is not an array in image_styles() (line 582 of /home/mysite/public_html/folder/modules/image/image.module)

I managed to fix the warnings by changing line 582 to:
$effect = array_merge((array)$definition, (array)$effect);

ie: (added "(array)" before each variable).

I would like to check with the module maintainers that this is not going to cause other problems and if not suggest this fix for inclusion in the dev branch. If it is the wrong approach can a proper fix be suggested?

system_maintenance migrations uses incorrect maintenance mode variable in Drupal 7 migrations

$
0
0

Problem/Motivation

The system_maintenance migration lists:

source:
  plugin: variable
  variables:
    - site_offline_message
  source_module: system

But site_offline_message hasn't been in use since #201415: Add permission to access site in maintenance mode, which was committed over a decade ago in https://git.drupalcode.org/project/drupal/commit/a9762cd3bf93ac8bbcafec2...😬

Proposed resolution

Change it to:

source:
  plugin: variable
  variables:
    - maintenance_mode_message
  source_module: system

Remove the variable 'site_offline_message' from the d7 fixture and keep the existing 'maintenance_mode_message', which has the same text so there will be no changes to the existing migration test.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Menu link content changes are not visible on non-live workspaces

$
0
0

Problem

Now that #2880152: Convert custom menu links to be revisionable is in, changes to menu links in non-live workspaces are not showing up. Making changes, and publishing changes from non-live to live works well. But it's not possible to preview the changes on the site's frontend.

This is probably due to cache issues where rendered menus needs to be cached per workspace.

Proposed solution

Cache menus per workspace.

API changes

None.

Viewing all 298718 articles
Browse latest View live


Latest Images

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