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

No access to some grouped multilingual fields on translation edit forms

$
0
0

The issue is that content_translation form checks on the #type of the fields. If this is a "vertical_tabs" section, than ignore it and continue.
But the hook_form_node_form_alter() within Claro and Seven change the #type of the vertical_tabs to container.

Therefor the #access is set to false and translateable fields in the advanced sidebar are not editeable. This is done by entityFormSharedElements in the ContentTranslationHandler, which is set as a #process handler after the form alters are done.

Somehow 'advanced' needs to be "ignored" if it contains fields which are translateable.

I though of two options:

1. The themes need to add their own process handler to correct this "issue". Because they break it in a way.
2. Or we need to mark it somehow as multilingual, by incorporating checks on #group when iterating through the elements in content_translation_form_alter().

The first option might be easy, because we could fix this specific issue. But in other cases this might still break (using the field group module, or even in commerce 2.x).

The second option would be the most generic way I guess. By checking the #group when iterating over the field definitions:

      foreach ($entity->getFieldDefinitions() as $field_name => $definition) {

        // Allow the widget to define if it should be treated as multilingual
        // by respecting an already set #multilingual key.
        if (isset($form[$field_name]) && !isset($form[$field_name]['#multilingual'])) {
          $form[$field_name]['#multilingual'] = $definition->isTranslatable();
        }
      }

We could check if #group is set. If so, and the #group element exists, set #multilingual true here as well.


Fix spelling in core.* yml files

$
0
0

Problem/Motivation

Most of these words are used once in a single file, some are in two files.
archiver
atomentry
atomfeed
atomrendererfeed
chainedfast
checkboxradio
configentity
configurator
contententry
contentrendererentry
controlgroup
derivedfrom
dublincoreentry
dublincorefeed
dublincorerendererentry
dublincorerendererfeed
itunesentry
itunesfeed
itunesrendererentry
itunesrendererfeed
kinberg
linkback
lrdd
mattfarina
phpserialize
pingback
podcastentry
podcastfeed
preconnect
refback
robloach
sayre
slashrendererentry
slatkin
threadentry
threadingrendererentry
timegate
timemap
trackback
webmention
wellformedwebentry
wellformedwebrendererentry

Remaining tasks

Review

Invalid config structures can result in exceptions when saving a config entity

$
0
0

I had multiple 8.4 upgrades failing with an error like this so far:

#0  Drupal\Core\Config\Schema\ArrayElement->get() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:179]
#1  Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:211]
#2  Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:211]
#3  Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:211]
#4  Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:211]
#5  Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:211]
#6  Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/StorableConfigBase.php:211]
#7  Drupal\Core\Config\StorableConfigBase->castValue() called at [/core/lib/Drupal/Core/Config/Config.php:212]
#8  Drupal\Core\Config\Config->save() called at [/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:280]
#9  Drupal\Core\Config\Entity\ConfigEntityStorage->doSave() called at [/core/lib/Drupal/Core/Entity/EntityStorageBase.php:392]
#10 Drupal\Core\Entity\EntityStorageBase->save() called at [/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:259]
#11 Drupal\Core\Config\Entity\ConfigEntityStorage->save() called at [/core/lib/Drupal/Core/Entity/Entity.php:377]
#12 Drupal\Core\Entity\Entity->save() called at [/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:637]
#13 Drupal\Core\Config\Entity\ConfigEntityBase->save() called at [/core/modules/views/views.post_update.php:213]
#14 {closure}()
#15 array_walk() called at [/core/modules/views/views.post_update.php:214]
#16 views_post_update_revision_metadata_fields() called at [/core/includes/update.inc:241]
#17 update_invoke_post_update() called at [/vendor/drush/drush/commands/core/drupal/batch.inc:163]
#18 _drush_batch_worker() called at [/vendor/drush/drush/commands/core/drupal/batch.inc:111]
#19 _drush_batch_command() called at [/vendor/drush/drush/includes/batch.inc:98]
#20 drush_batch_command() called at [/vendor/drush/drush/commands/core/drupal/update.inc:193]

So far, it was always a property inside a views filter, where it expects value to be a string but it's an array.

While it's bad that those mismatches exists, we ignore missing schema outside of tests, so I think we should also ignore those kind of problems, possibly just log them, without failing the update.

Example errors:
InvalidArgumentException: The configuration property display.default.display_options.filters.type.value.audio doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of /h
InvalidArgumentException: The configuration property display.default.display_options.filters.type_1.value.image doesn't exist.

Add a migration source plugin for JSON:API

$
0
0

Problem/Motivation

We have source plugins for Drupal 6 and Drupal 7, but not for Drupal 8. Instead of implementing, and then maintaining, a source plugin for Drupal 8 and later, let's create a source plugin for JSON:API and then take advantage of the JSON:API module, which has been in core since Drupal 8.7.0.

Once we have the source plugin, we will be able to use it for migrations from Drupal and from any other system that supports JSON:API.

Proposed resolution

Add a source plugin for JSON:API.

The source plugin should take advantage of the structure provided by JSON:API in order to simplify migrations based on this new source. At least the source plugin should handle

  • Paging through the source
  • Detecting the available fields

Remaining tasks

  • Write an end-to-end functional test, using data from the Umami profile exposed through the JSON:API module.
  • Write unit tests.
  • Decide whether to use PHP's json_decode() or an alternative parser.
  • Write the source plugin.
  • Add documentation.
  • Add a change record.

Completed tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

TODO

Claro: display the vertical scrollbar when many results are returned by linkit

$
0
0

Problem/Motivation

When using the linkit, it is possible to use linkit also on the link button in CKEditor. In this case, the default link field is replaced with an autocomplete field. The results window has a maximum size; if many results are returned by linkit, a scrollbar is displayed.
This does not work when using Claro as the admin theme, as the scrollbar is hidden. Hence, only the first 8 / 12 results are displayed to users; all the other results are hidden.

Steps to reproduce

  • Install drupal vanilla, select Claro as the admin theme;
  • Install linkit, enable the module and enable it also in the "CKEditor plugin" section of the Content authoring --> Text formats and editors page;
  • Create a bunch of nodes, e.g. 20 articles
  • Try to create a link via ckeditor, from any node.

The results will be displayed like this:

linkit claro

Proposed resolution

Replace overflow: hidden for the autocomplete field to overflow: auto (unless there's a good reason to keep it set to hidden).

User interface changes

The scrollbar will now be displayed also for autocomplete fields.

Support serialization of private properties

$
0
0

Problem

Because DependencySerializationTrait uses get_object_vars() to collect serializable service properties, but that function cannot access private properties. Because of that, the code below fails, because $entityTypeManager becomes null when deserialization happens.

<?php

final class MyForm extends \Drupal\Core\Form\FormBase {

  private $entityTypeManager;

  public function __construct(\Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager) {
    $this->entityTypeManager = $entityTypeManager;
  }

  public static function create(\Symfony\Component\DependencyInjection\ContainerInterface $container) {
    return new static(
      $container->get('entity_type.manager')
    );
  }
}

This seems to be a known limitation for 2 years or so: https://www.drupal.org/project/drupal/issues/2727011#comment-12619886

Proposed solution

Use Reflection or Clousers instead of get_object_vars().

TODOs

Monitor and measure performance changes: https://www.lambda-out-loud.com/posts/accessing-private-properties-php/

Allow appending values to multivalued fields during the migration

$
0
0

Problem/Motivation

For the moment during the entity import, we can compute the values for fields and save those as a result. In a case the "process" stage of an import returned "NULL" the value will be emptied. The other case - new value or set of values that will be saved for an entity, overriding the previous ones.

Imagine we have the "field_tags" for an entity and we doing an import into it. The type of field is "entity_reference" and it's multivalued. Initially, the source contains two tags: "a" and "b". The second import comes from the source that has "c" and "d" tags. What will be the result of two migrations? It'll be "c" and "d" unless process plugins haven't implemented some specific handling.

This issue is about allowing to merge the values among the incremental imports for specifically configured fields.

Steps to reproduce

Proposed resolution

an "append_properties" option on the destination plugin, which will add incoming source values to any pre-existing destination properties?

See #7, #8 and #12

Remaining tasks

Patch
Review
Commit

User interface changes

API changes

Data model changes

Release notes snippet

Block Context assignment form element rendered when only null option is available

$
0
0

Problem/Motivation

The ContextAwarePluginAssignmentTrait::addContextAssignmentElement(), when it collects $options, can end up with empty options in certain circumstances. This ends up displaying an empty select list on the block form.

Steps to reproduce

Two examples where [view_mode: null] is only option:
1. Create views block with a contextual filter on a plain text field. Add the views block via layout builder and form shows an empty select list.
2. Create views block with a contextual filter on Taxonomy term: Name via a relationship to a term. Add the views block via layout builder and form shows an empty select list.

Proposed resolution

Filter out null $options in addContextAssignmentElement()

Remaining tasks

Create patch to adjust ContextAwarePluginAssignmentTrait::addContextAssignmentElement()

User interface changes

Does not create select list for contextual filters on block form on null options.

API changes

none

Data model changes

none


Chainflix OEmbed endpoint breaks regex matching

$
0
0

Problem/Motivation

Tests started failing with the following error:
preg_match(): Unknown modifier 'w'

With the stacktrace

/data/app/core/modules/media/src/OEmbed/Endpoint.php:155
/data/app/core/modules/media/src/OEmbed/UrlResolver.php:135
/data/app/core/modules/media/src/OEmbed/UrlResolver.php:167
/data/app/core/modules/media/src/Plugin/media/Source/OEmbed.php:246
/data/app/core/modules/media/src/Entity/Media.php:258
/data/app/core/modules/media/src/Entity/Media.php:156
/data/app/core/modules/media/src/Entity/Media.php:392
/data/app/core/modules/media/src/MediaStorage.php:27
/data/app/core/lib/Drupal/Core/Entity/EntityBase.php:339
/data/app/profiles/custom/my_profile/tests/src/MediaTestTrait.php:146

Where line 146 is saving a video media entity.

This is caused by Chainflix having endpoints https://(m|www).chainflix.net/video/?* and https://(m|www).chainflix.net/video/embed/?*

The regex in matchUrl uses pipe characters as the regex delimiters.

Steps to reproduce

Save a new video media entity

Proposed resolution

Fix the regex replacement in \Drupal\media\OEmbed\Endpoint::matchUrl

Views query excludes items when both an exposed and normal Taxonomy Term filter is used

$
0
0

Views module is negating an argument with no reason apparently when 2 filters (one of them exposed) are used. This argument which is being negated is coming from a filter that has required arguments, thus producing no results.

I'm attaching a screenshot showing the bug.

Also, here is a link to a video that shows the error with a Drupal 8 site built using SimplyTest.Me.
https://drive.google.com/file/d/189040QqWmwLshRG9-SE5xHNwU7G_JV8E/view?u...

PHPStan error LinkItemTest

$
0
0

Problem/Motivation

From issue #3178534: Start running PHPStan on Drupal core (level 0): Start running PHPStan on Drupal core (level 0)

     Internal error: Internal error: Cannot assign an empty string to a string offset in file /app/core/modules/link/tests/src/Kernel/LinkItemTest.php                                                                
     Run PHPStan with --debug option and post the stack trace to:                                                                                                                                                     
     https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md     

Steps to reproduce

Proposed resolution

Probably this should be checked explicitly that this is not a string.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Make vocabulary label in administrative listing link to its list of terms

$
0
0

slightly related to #744258: admin/structure/taxonomy paths have to use machine_name, not vid (find a better issue about the taxonomy vocabular list admin page)

Problem/Motivation

"viewing" something is not usually in the drop button. In this case it is and I eventually found it. What I wanted to do was to click on the name of the vocabulary to get to the "list" tab.

Proposed resolution

Make the name of the vocabulary a link to the list tab.

Remaining tasks

create initial patch

User interface changes

link-vocab-name-to-list-terms-2013-01-17_1522.png

API changes

No API changes.

[drupalImage] upcast wrongly assumes that the "width" attribute value is always px

$
0
0

Problem/Motivation

config.image.resizeUnit to '%' not working in the backend editor after changes to images were made and saved.
Front end working as expected, but when going back to the editor to make more updates, images sizes not showing properly.
When inspecting element image, style width has both % and px added to the width number.
element inspect

Steps to reproduce

1. add image
2. resize image
3. save
4. check in the front end. It should look good
5. go back to the editor. Image is not shown in the correct size. when inspected: style="width:50%px;"
6. Image in the front end saved and shown correctly style="width:50%;"
7. problem only in the editor. in the backend

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Block derivatives labels are always shown in the first language they are view in after cache rebuild

$
0
0

Problem/Motivation

In Layout Builder, when you go to add a block to a section, and click "Create custom block", a list of links of the type of custom block content you want to add as a inline block appears. On a multilingual site, this list of links displays only in one language, which is language the site is using when it caches the derivate plugin definitions.

This is because of line 52 of docroot/core/modules/layout_builder/src/Plugin/Derivative/InlineBlockDeriver.php:
$this->derivatives[$id]['admin_label'] = $type->label();
Which sets the admin_label of the derivate plugin definition to a string instead of TranslatableMarkup.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Views doesn't show any nodes when the original language node is unpublished

$
0
0

I have a node translated into several languages and a view showing a list of content in the user language. If i edit a translation and i set upublished everything works, only the unpublished translation is not visible. If i unpublic the original language, in view of all the translations are not visible (even if they are delivered correctly). If resave translated content works, just that the original language notpublished is not saved for last.
The query is correct, the problem will be somewhat after preprocess.


Add gitignore(s) to composer-ready project templates

$
0
0

Problem/Motivation

The composer-ready project templates nearly shipped with a .gitignore that would have caused all the composer-managed files to be excluded from any git repository the owner of the new project might set up. Discussion late in #2982680: Add composer-ready project templates to Drupal core revealed that there are established and opposing schools of thought about whether vendored files should be a part of one's git repository. That .gitignore was deemed too opinionated for core, and it was just removed entirely with the creation of this follow-on issue to find a more helpful solution.

Excluding any .gitignore from the official composer-built drupal/recommended-project project template is very likely to create an immediate chore for users of it, to figure out what is an appropriate .gitignore for Drupal and get it added to their project.

We would like to provide a .gitignore starting point in our project templates for these two personas:
a) People who deploy site updates using only git, and so require all code to exist in git.
b) People who do not want large quantities of vendored code in their git repository, and develop advanced CI/build artifact systems to deploy site updates.

Proposed resolution

Have one well-documented .gitignore per project template that meets persona a)'s needs without modification, and has the additional rules desired by persona b) commented out. This simple approach bypasses a number of unsolved technical problems with the scaffold plugin that were surfaced in work between patches #35 and #70.

Remaining tasks

  • Decide if we want both .gitignore and example.gitignore in the project template files.
  • Decide if we want to add .gitignore to the download tarballs (perhaps not?)
  • Decide on a strategy on how to exclude .gitignore in downloads but not in the project templates, if that's what we decide.
  • Decide if we want to stick with the proposed resolution (vendor committed by default), or reverse to match existing example gitignore file (which by default ignores vendor)

Also use text editor (CKEditor) for "summary" of a text field

$
0
0

Problem/Motivation

The Summary part of the textfield should have a WYSIWYG Editor because the format applies to body and summary.

Proposed resolution

@todo
- Lock down the format for summary in the widget. (?)

Remaining tasks

  1. Update this summary to accurately reflect the proposed change.
  2. Fix the existing test failures.
  3. Add new tests to cover the new functionality.
  4. Move this back to 'Needs review'
  5. Reviews/refinements.
  6. RTBC.
  7. Commit.

User interface changes

WYSIWYG editor available on the separate 'Summary' field on text areas that support them.

Before

After

API changes

TBD.

Data model changes

TBD, hopefully none.

Empty toolbar tray displays a stray orientation toggle

$
0
0

Problem/Motivation

Background

It is currently possible that a toolbar is empty, i.e. that there is a link in the toolbar but no actual toolbar menu items are revealed when clicking on that link. This happens most prominently when granting users the access toolbar permission, but no access to any administrative pages. Then the "Manage" toolbar item will appear, but without any actual links.

The fact that this is currently the case is being discussed - and potentially fixed - over in #2135445: Toolbar displays Manage tab even if the user is not permitted to see it, but until that is resolved this constitutes a separate bug.

Problem description

When there is an empty toolbar tray, the orientation toggle is still displayed. It does in fact allow switching the orientation, but this is pointless as there are no menu items. Moreover, in (the default) horizontal orientation the toggle "floats" beneath the toolbar where the tray would usually be displayed - except that there is no tray, only the toggle.

Screenshot of the bug with the orientation toggle floating beneath the toolbar

Steps to reproduce

Grant a user only access to access the toolbar, nothing more.

Proposed resolution

Don't add the orientation toggle if there is no tray.

Remaining tasks

User interface changes

The toolbar toggle is no longer erroneously displayed for empty trays.

API changes

-

Data model changes

-

Release notes snippet

Toolbar displays Manage tab even if the user is not permitted to see it

$
0
0

Problem/Motivation

Sites might want to give users access to the toolbar that aren't actually admins. For example, to provide easy access to shortcuts, a more slick user menu experience, etc. Toolbar doesn't have to just be for admins.

However, as currently written, toolbar.module assumes that anyone seeing the toolbar must be an admin, and it always provides a "Manage" tray, even if the user cannot access any admin links and the tray is empty.

Note: although the machine name for the permission to use the toolbar is just access toolbar, the label in the admin UI is unfortunately called "Use the administration toolbar". Fixing that is at #3025839: Change toolbar's permission label to 'Use the toolbar'. A more complete solution for this will be at #1044090: Enable toolbar for authenticated users also, so that non-admin users can use shortcuts as well. This issue is only about fixing the bug in the toolbar that renders an empty tray, not about "rebranding" the toolbar to stop assuming only "admins" use it.

Steps to reproduce

  1. Disable shortcut module (to avoid confusion).
  2. Create a user with access toolbar permission but nothing admin-related. In particular, not access administration pages.
  3. Login as the non-admin auth user.
  4. You should see an empty "Manage" tray in the toolbar (along with the "User" tray).
  5. If you apply the latest patch, clear all caches, and reload a page, the "Manage" tray should disappear and you should just have the User tray.

Proposed resolution

Test if the current user has at least one of the following permissions before doing any work to create/render the "Manage" link and tray in the toolbar:

  • access administration pages
  • access content overview
  • access media overview
  • administer blocks
  • administer comments
  • administer nodes

It'd be "better" to see if the admin menu is in fact empty for the user, but thanks to lazy loading, #pre_render, #2301317: MenuLinkNG part4: Conversion and all sorts of other unfathomable complication, that code is now far removed from where we actually register the 'Manage' toolbar link/tray.

Remaining tasks

  1. Write and verify test (comment #27)
  2. Write code that fixes failing test (comment #39)
  3. Review
  4. Commit
  5. Rejoice (and unblock [#1044090])

User interface changes

Fixes a UI bug where an empty "Manage" tray appears for users who don't have access to any administration pages.

Before

Screenshot before fix showing empty 'Manage' tray

After

Screenshot after fix showing no 'Manage' tray at all

API changes

None.

Original report by @jessebeach

Almost anyone developing on Drupal 8 has admin privileges to their local site. We rarely see that Toolbar module under a permission set that doesn't have god-access.

We need to do some permission combo tests and verify that the Toolbar renders and displays well when a user does not have bypass privileges, but simple privilege sets that someone like a content editor might have.

Permission Combinations

Standard authenticated user with use administration toolbar permission

The Menu tab is visible and the tray is empty. The tab should not be visible.

Test the Toolbar against reduced permission sets that simulate non-admin users: content producers, content editors, site builders, etc.

Layout builder not able to manage field visibility

$
0
0

Scenario example:
- Having a comment field in a node type (NOT hidden from display in field UI setting).
- Enable layout builder then remove the comment field from layout builder.
- Save and check exported entity_view_display.node yml.
Problem: field_comments is under content instead of hidden.

Issues caused:
LayoutBuilderEntityViewDisplay::buildMultiple call its parent EntityViewDisplay::buildMultiple which gets all components and builds render array. That causes two issues:
1. Possible performance impact. Unwanted fields still being rendered (though not output for display).
2. Pager ID in views conflicts. In my case if you list all nodes with a pager in a view, you may see pager won't work due to pager id conflict b/w individual comment(which is comment module own behaviour) and the view itself.

Quick Workaround
- Manually edit entity_view_display.node yml to move field_comments to hidden and re-import it.
- Hide unwanted fields before enable layout builder for the display mode.

Possible Solution

  1. Option 1: when removing the field_comments from layoutbuilder, update display mode setting accordingly. It feels not hard, however, I didn't find an easy way to retrieve related display mode from RemoveBlockForm
  2. Option 2: alter LayoutBuilderEntityViewDisplay behaviour to discard invoking parent method, instead, build its own logic. Not sure if it's really feasible
Viewing all 296285 articles
Browse latest View live


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