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

PHP Phar Stream Wrapper should be updated to fully support PHP7.4

$
0
0

Drupal core is shipped with https://github.com/TYPO3/phar-stream-wrapper library. It should be updated in order to support PHP7.4

See: https://github.com/TYPO3/phar-stream-wrapper/issues/49

Seems like most of the compatibility issues are in tests, see https://github.com/TYPO3/phar-stream-wrapper/pull/50

Actual issue affecting the library has already been patched (but master branch only, which is PHP7+, and we need v2, which is PHP5+): https://github.com/TYPO3/phar-stream-wrapper/commit/27899b820ae69c500517...


Remove usage of spaceless tag in Twig templates

[META] Select the best modern editor for Drupal 9

$
0
0

Problem/Motivation

When Drupal integrated CKEditor 4 into Core it was the best available solution at that moment in time.

Since then the editor landscape has shifted dramatically.

Therefore we - as a Community - need to select a new editor for Drupal 9, so that we can deprecate CKEditor 4.

We (at Tag1) recently did a larger survey of available editors in the space and there is more than just CKEditor 5.

As there is no upgrade path for CKEditor 4 to 5, there is no reason that we need to just update to the next version.

We (at Tag1) published a blog post about our detailed findings soon, which could become a starting document for this issue:

https://tag1consulting.com/blog/modern-rich-text-editors-how-evaluate-ev...

For now we talked about the editors and challenges in integrating them with Drupal 8 here:
https://tag1consulting.com/blog/deep-dive-rich-text-editors-tagteamtalk-002

The list of editors we evaluated are:

- CKEditor 5 (https://ckeditor.com/ckeditor-5/)
- Prosemirror (https://prosemirror.net/) (used by New York Times, Evernote, Atlassian (JIRA, Confluence))
- QuillJS (https://quilljs.com/) (LinkedIn, Slack)
- DraftJS (https://draftjs.org/) (Facebook)
- SlateJS (https://www.slatejs.org/)
- Gutenberg editor (https://www.drupal.org/project/gutenberg)

All of those are using an internal JSON based model (some tree based, some differential based).

All of those support real-time collaborative editing ala Google Docs / Etherpad (except Draft?) in general, which could become more and more important in the future.

Proposed resolution

- Create list of criteria: e.g.

- Audit the DX and UX of the editors (How easy is it to write a plugin? How easy are complex plugins?)
- Audit the Community and Support of the editors (Is it maintained well? Is it a good OSS project?)
- Audit Accessibility
- ...

and find the best solution for what Drupal 9 needs.

Remaining tasks

- Discuss
- Create child issues
- Start implementing and testing

Create token site:base-path with value of base_path()

$
0
0

I would like a token site:base-path which contains the value returned by base_path().

If approved, I will write a patch.

Need the ability to embed YouTube videos without the related video thumbnails

$
0
0

The best way I could figure out to do this was with a hack of media-oembed-iframe.html.twig, forcing ?rel=0 into the URL.

Seems like this should be an option in the display settings of the embedded video media type.

If you, like me, want this to work, I did it with twig, this is the contents of my overridden media-oembed-iframe.html.twig file (Also with the

tag that allows responsive videos):
{#
/**
 * @file
 * Default theme implementation to display an oEmbed resource in an iframe.
 *
 * @ingroup themeable
 */
#}
<!DOCTYPE html>
<html>
<head>
  <style>
    iframe {
      position: absolute;
      left: 0;
      top: 0;
      right: 0;
      bottom: 0;
      margin: 0;
      width: 100%;
      height: 100%;
    }
  </style>
</head>
<body style="margin: 0">
{{ media|replace({ "?feature=oembed": "?rel=0&feature=oembed"  })|raw }}
</body>
</html>

Sort options for entity reference field are unsorted

$
0
0

Problem/Motivation

This is a portion of #2900409: [Meta] Improve UI of Reference field settings form, separated out after comment #133.

If you create an Entity Reference field, when you get to the Field Settings dialog, you will find that the options for what field to use to sort the entities presented for referencing are unsorted. Here's what they look like:
Sort options for reference field

Proposed resolution

Use the new #sort_options property of Select elements to sort the options. This came from
#3065903: Add label sort ability to Select element

Completed tasks

Remaining tasks

  • Add screenshots. (Novice)
  • Add tests.

User interface changes

Sort options will be sorted when setting up an Entity Reference field.

API changes

None.

Data model changes

None.

Release notes snippet

Probably not necessary. Small UI fix.

all my script files does't render

$
0
0

Hi all,

I am having an issue where all the theme JavaScript files not rendered. and it replace them with base_url link.

like this: <script src="base_url"></script>

thanks

Fixed:
There was permission issue with JavaScript files.
I still wonder why drupal need to duplicate the JavaScript and css file into new file.

Update Twig to 1.41

$
0
0

Problem/Motivation

In order to replace deprecated in Twig 2 spaceless tag templates should use apply tag which is available since Twig 1.40.
#3094850: Remove usage of spaceless tag in Twig templates

In order to replace deprecated in Twig 2 "if" condition on "for" loop templates may use filter filter which is available since Twig 1.41.
#3094848: Remove usage of the "if" condition in the "for" tag in Twig templates

Twig 1.40 has a critical bug fixed in 1.40.1.
#3051269: Updating Drupal 8.6.x to twig 1.40.0 causes twig exceptions

Proposed resolution

Update Twig to 1.41.

Remaining tasks

Create a patch


Canonical taxonomy term link for forum vocabulary is broken

$
0
0

Problem/Motivation

Currently rendering of canonical taxonomy term link for forum vocabulary is broken and have no test coverage.

To be more consistent with the object-oriented architecture need to implement Drupal\Core\Entity\EntityInterface::uri() method and drop taxonomy_term_uri() function and clean-up Term annotation uri_callback.

Proposed resolution

Implement a path processor outbound service to make this work again and add test. Remove taxonomy_term_uri() and forum_uri() functions as useless because entity templates are takes precedence.

Remaining tasks

Contributor tasks needed
TaskNovice task?Contributor instructionsComplete?
We have manually tested the patch and confirmed that it has not been rolled.NoviceInstructionsYes
Reroll the patch.InstructionsYes
Draft a change record for the API changesInstructionsYes
Profiling (see comment #49)Yes

User interface changes

API changes

Original report by @andypost

Part of #2010184: [meta] convert ‘uri_callback’ entities param to EntityInterface::uri() method

Needs to implement Plugin\Entity\Term.php uri() method and drop taxonomy_term_uri() function replacing it's calls to $term->uri() and clean-up Term annotation uri_callback

Option for _none is removed once a field has a value and can cause accidental data corruption

$
0
0

When you create a required single-value entity reference field, for example a term reference, then the referenced entity is deleted, the _none option disappears. When the widget is loaded up it defaults to the first option in the list, and the user can easily save the new value without noticing. Steps to reproduce below.

  1. Install Drupal with the standard profile
  2. Change the Tags field to Required, Allowed number of values to 1
  3. Change the Tags widget to Select list
  4. Create two terms in the Tags vocabulary, "foo" and "bar"
  5. Create an article node, set the Tags field to "foo"
  6. Delete the "foo" term
  7. Edit the article node, the widget now has "bar" selected
  8. Save the article node

I believe this tracks back to OptionsSelectWidget::getEmptyLabel() which checks for !$this->hasValue. It doesn't consider whether the stored value is actually present in the available options.

ConfigurableLanguageManager::getLanguageSwitchLinks() should perform access check

$
0
0

Problem/Motivation

ConfigurableLanguageManager::getLanguageSwitchLinks() should respect current user access level.

Steps to reproduce:

- Enable language module
- Have more than one language installed (EN, DE for example)
- Create content type with translatable "Published" (status) field.
- Place language switcher block in the content region.
- Create and published node in EN
- Create draft of DE translation
- Visit EN node as anonymous user

Expected result: See only "EN" in language switcher
Actual result: EN and DE links

There is a workaround of hook_language_switch_links() that is called right after getting raw links from language switcher negotiator, but having access checks right away looks as proper solution.

Proposed resolution

Use #access_callback returned by Url::toRenderArray()?

Remaining tasks

- Write patch
- Write test

Incorrect Views node theme suggestions when rendering same node in two different Views

$
0
0

When rendering the same node in different Views displays on the same page, all instances of the node receive theme suggestions for the last View.

Rough steps to reproduce

  1. Create Views foo and bar each with a display block_1 and their row format configured to show content (instead of fields).
  2. Place both Views displays on the same page, e.g., via Layout Builder, with foo first and bar second.
  3. Enable theme debugging.
  4. Inspect the markup to see that all instances of a given node receive theme suggestions for last View, i.e., node__views__bar and node__views__bar__block_1.

Cause

  • Views implements hook_theme_suggestions_HOOK_alter() to add the suggestions. It relies on a special key on the node object called view (a ViewsExecutable) to pull the View ID and display ID.
  • TranslationLanguageRenderer::preRender() provides that ViewsExecutable on the node entity.
  • But that node entity was loaded via NodeStorage:load(), which allows for static caching of Node objects via EntityStorageBase::getFromStaticCache().
  • Static caching of the Node objects means that the same instance is being shared across all Views on the page, and therefore the special $node->view key gets overwritten by subsequent Views.

Solution

I'm not sure, but perhaps #2511548: Add a "context" array variable to all theme hooks and "#context" array property to all elements to provide optional contextual data will mitigate this by allowing TranslationLanguageRenderer::preRender() to pass the ViewsExecutable via context rather than as a special key attached to the Node object.

Call to a member function set Weight() on null in Drupal\language\Configurable LanguageManager->updateLockedLanguageWeights()

$
0
0

I encounter an error when I want to add a new language in the Drupal site using /admin/config/regional/language/add path.
The error is:
'Error: Call to a member function set Weight() on null in Drupal\language\Configurable LanguageManager->updateLockedLanguageWeights()'

Even if the error is received the language is created when I go on the language list.

I am using Drupal 8.5.1 version.

Add missing type hint to TypedDataInterface::createInstance() method

Remove usage of the "if" condition in the "for" tag in Twig templates

$
0
0

Problem/Motivation

Support of if condition in for tag was deprecated in Twig 2 and removed in Twig 3.

Proposed resolution

Update core templates.

Remaining tasks

Discuss. Patch. Commit.

User interface changes

None.


Skip_on_empty doesn't work after a failed migration lookup with multiple destination ids

$
0
0

Problem/Motivation

The changes I made to the D7 source while working on #3008028: Migrate D7 i18n menu links caused an unexpected and unrelated error,

[error] Attempt to create a field field_text_plain_filtered that does not exist on entity type node. (/opt/sites/d8/core/modules/field/src/Entity/FieldConfig.php:312)

while running d7_field_instance_label_description_translation migration. That migration should not be trying to save to a field that does not exist and it even has a skip_on_empty to prevent that.

There are several issue already for improvements and fixes to migration_lookup but I didn't see this particular problem there.

  exists:
    -
      plugin: migration_lookup
      migration: d7_field_instance
      source:
         - entity_type
         - objectid
         - type
    -
      plugin: skip_on_empty
      method: row

However, the skip does not skip when the field does not exist. When the field does not exist migration lookup returns an array with 3 elements, all NULL and thus there is no SkipRowException.

Proposed resolution

Option 1) Change migration_lookup to return NULL when all elements of the return array are NULL.
Option 2) Alter all the migration yml that have a migration_lookup where an array of NULL might be returned and that is followed by a skip_on_empty to include a callback process with array_filter. I guess that will work.

Remaining tasks

Write a patch
Add some tests
Review

User interface changes

N/A

API changes

Migration lookup returns NULL instead of an array where all elements are NULL

Data model changes

Release notes snippet

No-blank is not recognized in config by migration process checker

$
0
0

If you forget to pass a blank inside of a process line like in this example (one between 'title:' and 'name'), then an error is thrown, which is not realy useful.

process:
  title:name

Such a migration config could be imported with no error, but throws next error on any other migration command, i.e. migrate-status:

[error] TypeError: Argument 1 passed to Drupal\migrate\Plugin\Migration::getProcessNormalized() must be of the type array, string given, called in web\core\modules\migrate\src\Plugin\Migration.php on line 634 in Drupal\migrate\Plugin\Migration->getProcessNormalized()

Better if the migration recognize the missing blank on importing the configuration.

Config can be created twice during module install.

$
0
0

It seems like the ConfigEntityInterface::isSyncing() method only returns TRUE during a (single) config import (started from the UI) or during a full config synchronization.

However, becasue isSyncing() returns FALSE during the configuration import while installing a module, we can potentially create the same config twice, leading to unexpected behavior in hooks that act upon the creation.

A simple example

Imagine a module that creates a config entity foo.node_type_meta.NODE_TYPE.yml whenever a node type is created. In the code, it's only created if $node_type->isSyncing() returns FALSE, because we do not want to create it during a configuration sync.

  • CORRECT: When I create a node type through the API or UI, isSyncing() is FALSE and the setting is created
  • CORRECT: When I import node.type.bar.yml, isSyncing() is TRUE and the setting is not created. If I want the setting too, it needs to be part of my import.
  • PROBLEM: When I install a module that has a config/install/node.type.baz.yml, isSyncing() is FALSE and the setting is created. See below why this is bad.

Where it breaks

Now suppose my module has both node.type.baz.yml and foo.node_type_meta.baz.yml. What happens is that the node type is installed first because the meta config should depend on it.

During the node type saving process, my meta config is already created with the default values only to be overwritten right after that with the config from the Yaml file. This leads to my meta config being saved twice.

The reason this is allowed, is because ModuleInstaller calls $config_installer->checkConfigurationToInstall('module', $module); at the start of the installation at which point the meta config entity did not exist yet. Later on, the config is saved using the trusted data flag ($entity->trustData()->save() or $new_config->save(TRUE)), meaning Drupal won't complain about it existing already.

Why it's hard to solve

We do not want to set isSyncing() to TRUE during module install because we would then require a module that provides a node type to know about all the modules that could possibly create config based on node type creation. After all, if they don't provide said additional configuration in config/install, said config would never be created because isSyncing() is TRUE.

Additionally, we can't easily inform $config_installer->checkConfigurationToInstall('module', $module); that certain config will be created while other config entities are being saved. So we can't fix it there either.

Possible solution

Provide an easy way to check whether the config you want to create exists in Yaml but has not yet been imported. That is, if there isn't already an easy way to do so. Then document this clearly, perhaps in ConfigEntityInterface::isSyncing(), so that module maintainers know they should use it to prevent their config from being saved twice.

It could look like this:

  public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    parent::postSave($storage, $update);

    if (!$update && !$this->isSyncing()) {
      $foo_id = $this->id() . '-foo';

      // Only create a foo entity if it won't be imported.
      if (!$some_service->willBeImported($foo_id)) {
        Foo::create([
          'id' => $foo_id,
          'node_type' => $this->id(),
        ])->save();
      }
    }
  }

Follow-up to #3084843: Re-generate production CSS files

$
0
0

Problem/Motivation

#3084843: Update browserslist browsers updated the browserslist browsers to match with the updated Drupal browser support policy #2390621: [policy, no patch] Update Drupal's browser support policy. As part of the issue we ensured that there were no changes to production JavaScript. However, browserlist is also used by our CSS tooling and this leads into some changes in the production code.

Proposed resolution

Re-generate production CSS files.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Some oEmbed videos do not maintain aspect ratio

$
0
0

With some providers (Youtube from what I could find) we have aspect ratio problems when we render them using the OembedFormatter.

The problem I discovered is primarily with Youtube: the resource returned from Youtube does not contain the requested width/height but the default size (or simply A size) of the video. This is fine if the formatter is configured to use a width and height that corresponds to the aspect ratio of that particular video. But that won't ever happen. When we configure the formatter to a specific max width but a height of 0, there is at least some expectation that the rendered iframe maintains the aspect ratio. At the moment, since the formatter is configured to a *max* width and no *max* height the iframe gets that that width attribute and the default height that comes from the resource. So the result is that the iframe size doesn't match the size of the video. A solution for this is to calculate the aspect ratio of the video using the values in the resource and recalculate the height attributed based on that in case the max height is configured as 0.

Discussing with @phenaproxima we might make a checkbox (default unchecked) for this in order to prevent BC.

Other providers, like Vimeo, may not have this issue. So in these cases this should not apply. But youtube is pretty important.

Viewing all 293729 articles
Browse latest View live