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

JSON API does not support array callable route controllers

$
0
0

Problem/Motivation

Warning: strpos() expects parameter 1 to be string, array given in Drupal\jsonapi\Routing\Routes::isJsonApiRequest() (line 268 of core/modules/jsonapi/src/Routing/Routes.php).

Steps to reproduce

Implement a route subscriber and provide a controller callable in array form (e.g., [MyClass::class, 'method'] or [$object, 'method`]).

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Error: Call to a member function label() on null in Drupal\menu_link_content\Form\MenuLinkContentForm->form() (line 99 of /var/www/html/docroot/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php).

$
0
0

Problem/Motivation

Getting below error when adding/ editing menu link from group content menu after update from Drupal 10.1.7 to Drupal 10.2.0
Error: Call to a member function label() on null in Drupal\menu_link_content\Form\MenuLinkContentForm->form() (line 99 of /var/www/html/docroot/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php).

Steps to reproduce

1. Install group content menu.
2. Install group as well.
3. Then, Create menus type under the group content menu.
4. Now, Install the menu for the group type under the group content setting.
5. Try to add new link on group menu.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Fix inconsistencies of TextareaWidget and TextareaWithSummaryWidget form elements

$
0
0

Problem/Motivation

  • Templates of text_format_wrapper print `attributes` to the description what ends in uninterpretable aria attribute.
  • Text summary behavior (text/drupal.text library) uses theme-provided classes for it's operations which may be broken in custom themes.

Proposed resolution

Fix text_format_wrapper by printing attributes to the main wrapper and providing the missing attribute for the description.
Add js classes to the TextareaWithSummaryWidget for the text/drupal.text library (where text/drupal.text is attached).

Remaining tasks

Provide a patch with test.

User interface changes

Nothing.

API changes

None.

Data model changes

Nothing.

Release notes snippet

@Todo

Add validation constraints to text.settings

$
0
0

Problem/Motivation

vendor/bin/drush config:inspect --filter-keys=text.settings --detail --list-constraints

➜  🤖 Analyzing…

 Legend for Data:
  ✅❓  → Correct primitive type, detailed validation impossible.
  ✅✅  → Correct primitive type, passed all validation constraints.
 ------------------------------------------ --------- ------------- ------ ------------------------------------------
  Key                                        Status    Validatable   Data   Validation constraints
 ------------------------------------------ --------- ------------- ------ ------------------------------------------
  text.settings                              Correct   75%           ✅❓   ValidKeys: '<infer>'
   text.settings:                            Correct   Validatable   ✅✅   ValidKeys: '<infer>'
   text.settings:_core                       Correct   Validatable   ✅✅   ValidKeys:
                                                                              - default_config_hash
   text.settings:_core.default_config_hash   Correct   Validatable   ✅✅   NotNull: {  }
                                                                            Regex: '/^[a-zA-Z0-9\-_]+$/'
                                                                            Length: 43
                                                                            ↣ PrimitiveType: {  }
   text.settings:default_summary_length      Correct   NOT           ✅❓   ⚠️  @todo Add validation constraints here
 ------------------------------------------ --------- ------------- ------ ------------------------------------------

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Claro Navigation toolbar arrow disappears

$
0
0

Problem/Motivation

Steps to reproduce

As image shown, the admin toolbar navigation menu arrow disappaers.

Proposed resolution

remove the background-color of is-active class.

.toolbar .toolbar-tray .menu-item--active-trail > .toolbar-box a,
.toolbar .toolbar-tray a.is-active {
color: #000;
background-color: #f5f5f5;
font-weight: bold;
}

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Add validation constraints to user.settings

$
0
0

Problem/Motivation

vendor/bin/drush config:inspect --filter-keys=user.settings --detail --list-constraints

➜  🤖 Analyzing…

 Legend for Data:
  ✅❓  → Correct primitive type, detailed validation impossible.
  ✅✅  → Correct primitive type, passed all validation constraints.
 ----------------------------------------------------- --------- ------------- ------ ---------------------------------------------------------------------------------------------
  Key                                                   Status    Validatable   Data   Validation constraints
 ----------------------------------------------------- --------- ------------- ------ ---------------------------------------------------------------------------------------------
  user.settings                                         Correct   84%           ✅❓   ValidKeys: '<infer>'
   user.settings:                                       Correct   Validatable   ✅✅   ValidKeys: '<infer>'
   user.settings:_core                                  Correct   Validatable   ✅✅   ValidKeys:
                                                                                         - default_config_hash
   user.settings:_core.default_config_hash              Correct   Validatable   ✅✅   NotNull: {  }
                                                                                       Regex: '/^[a-zA-Z0-9\-_]+$/'
                                                                                       Length: 43
                                                                                       ↣ PrimitiveType: {  }
   user.settings:anonymous                              Correct   Validatable   ✅✅   Regex:
                                                                                         pattern: '/([^\PC])/u'
                                                                                         match: false
                                                                                         message: 'Labels are not allowed to span multiple lines or contain control characters.'
                                                                                       NotBlank: {  }
                                                                                       ↣ PrimitiveType: {  }
   user.settings:cancel_method                          Correct   NOT           ✅❓   ⚠️  @todo Add validation constraints here
   user.settings:langcode                               Correct   Validatable   ✅✅   NotNull: {  }
                                                                                       Choice:
                                                                                         callback: 'Drupal\Core\TypedData\Plugin\DataType\LanguageReference::getAllValidLangcodes'↣ PrimitiveType: {  }
   user.settings:notify                                 Correct   Validatable   ✅✅   ValidKeys: '<infer>'
   user.settings:notify.cancel_confirm                  Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }
   user.settings:notify.password_reset                  Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }
   user.settings:notify.register_admin_created          Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }
   user.settings:notify.register_no_approval_required   Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }
   user.settings:notify.register_pending_approval       Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }
   user.settings:notify.status_activated                Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }
   user.settings:notify.status_blocked                  Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }
   user.settings:notify.status_canceled                 Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }
   user.settings:password_reset_timeout                 Correct   NOT           ✅❓   ⚠️  @todo Add validation constraints here
   user.settings:password_strength                      Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }
   user.settings:register                               Correct   NOT           ✅❓   ⚠️  @todo Add validation constraints here
   user.settings:verify_mail                            Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }
 ----------------------------------------------------- --------- ------------- ------ ---------------------------------------------------------------------------------------------

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Add validation constraints to system.logging

$
0
0

Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Entity query alter with cacheable metadata leaks and triggers LogicException

$
0
0

I have an entity query_alter that was adding a cacheable metadata to a jsonapi response and before it was working and now I get: `LogicException: The controller result claims to be providing relevant cache metadata`, any ideas? I am altering the json query by a passed argument on the url and I want that resource to be be varied by that url argument, but it seems I should not be adding it on the query alterer now, which would be the proper way?

I am/was doing this on

function microsite_query_entity_query_alter(Drupal\Core\Database\Query\AlterableInterface $query) {
  $request = \Drupal::requestStack()->getCurrentRequest();
  $renderer = \Drupal::service('renderer');
  if ($request->isMethodCacheable() && $renderer->hasRenderContext()) {
    $build = ['#cache' => ['contexts' => ['url.query_args:microsite_site']]];
    $renderer->render($build);
  }
}

This stopped to work after recent upgrades to core/jsonapi.

@wimleers asked

What code path in JSON:API is triggering your code to be executed? JSON:API should have the appropriate “run entity queries in a render context so it can detect bubbled cacheability and associate it with the resulting response” logic in place. If it doesn’t, that’d be a bug.

I answered: Does this answer your question https://pastebin.com/T0RvpbX3? The first path I actually now see that it’s captured and bubbled up, however the others (one per media entity) are not. Please ignore the `microsite` controller. It’s currently a bare decorator for the jsonapi controller service to add the cache context on an overridden `buildWrappedResponse()` (PoC from yesterday), but I rather not have to do something like this.

He said yes and asked to fill in a ticket, so here it is.

In the end I removed the decorator end ended up replacing the whole jsonapi.entity_resource service with the same `buildWrappedResponse()` overridden to add my needed context but not to have to override also the constructor on the decorator.

From Slack: https://drupal.slack.com/archives/C6DJEP1EK/p1556217296004400 (likely to be lost in the backscroll noise but here for reference)


[upstream] CKEditor 5 reorganizes inline HTML tags: <a> first, then <em>, then <span>

$
0
0

Problem/Motivation

CKEditor 5 changes the HTML Structure almost immediately. This doesn't affect the pre-existing HTML structure of different pages until and unless we open those respective nodes in /edit mode.

Steps to reproduce

  1. Setup a D10 Site.
  2. Enable CKEDitor 5
  3. Configure any text format to use "CKEditor 5" as the text editor in /admin/config/content/formats
  4. Input the following in "Source" -
    <div class="social-media">
    <span>Share</span> 
    <span class="icon">
    <a href="#" target="_blank" rel="noopener">
    <em class="fa-fw fa-twitter fab">&nbsp;</em>
    </a>
    </span>
    </div>
  5. The structure gets changed into -
    <div class="social-media">
    <span>Share</span>&nbsp;
    <a href="#" target="_blank" rel="noopener">
    <em class="fa-fw fa-twitter fab">
    <span class="icon">&nbsp;</span>
    </em>
    </a>
    </div>

Proposed resolution

Make sure that the HTML Structure doesn't get changed.

Improve and add explicit test coverage for the workspace conflict validator

$
0
0

Problem/Motivation

\Drupal\workspaces\Plugin\Validation\Constraint\EntityWorkspaceConflictConstraintValidator was written in a time when we didn't have the workspace association service, which is easier to query and faster then getting the latest revision ID of an entity (and loading it afterwards).

Proposed resolution

Stop checking the latest revision of the edited entity, and check the workspace association index instead.

Remaining tasks

Review.

User interface changes

Nope.

API changes

Nope.

Data model changes

Nope.

Release notes snippet

Nope.

Do not want to save invalidate cache tag in Database when submitting a webform

$
0
0

There are number of entries inserted in cachetags database table while user submitting the form. Currently we do not want to invalidate the cachetags on every submission as we are sending the data to thirdparty.

Is there a way to stop cachetags invalidation on webform submit ?

BlockCreationTrait::placeBlock() should explain visibility

$
0
0

Problem/Motivation

   *   The following defaults are provided:
   *   - label: Random string.
   *   - id: Random string.
   *   - region: 'sidebar_first'.
   *   - theme: The default theme.
   *   - visibility: Empty array.

What does an empty array mean for visilibity? Visible everywhere or nowhere? The docs should say.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Plan for statistics in contrib

$
0
0

Problem/Motivation

Longstanding core module statistics is being deprecated and removed from core, following #3413917: Deprecate the Statistics module, #3340834: [meta] Tasks to deprecate Statistics and other related issues.

Because statistics is still used by many sites, 5% to 9% depending on which numbers you want to, that means at least 800k*5% = 40k sites, presumably smaller ones not using data-grabbing third-party SaaS, it needs at the very least to be preserved.

Because it has received comparatively little attention over the years, it also needs to be improved, and there are multiple directions for that.

Proposed resolution

  1. Create temporary project holding the core split until the core tasks reach the point where drupal.org/project/statistics can be created
  2. create drupal.org/project/statistics when approved: created and unpublished
  3. repatriate work from the temporary repo to that new official project
  4. migrate remaining core issues related to statistics on the 11.*, 10.* and 9.* branches, but not earlier ones, or those related to the core removal process, to the new project
  5. perform triage on core 7.* issues, moving those still relevant to the new project, and leaving others in place until final D7 EOL
  6. perform triage on issues, priorizing
    1. bugs on 11.x
    2. bugs on 10.*
    3. bugs on 9.* (no remaining issue on 8.x)
    4. non-bug issues
  7. define axes of development. Initial axes envisioned, in no particular order:
    • scope extensions
      • tracking of all (content) entity views canonical pages
      • tracking of other view types, possibly per view mode
      • non-entity tracking (e.g. landing pages)
    • collection extension
      • longitudinal statistics for sites with enough traffic
      • longitudinal statistics for smaller sites with traffic low enough that stats cannot be collected often enough for lack of incoming requests and no external cron
      • support for offline data collection/shipping to decouple statistics and their rendering from core storage
      • support for more granular collection, probably by roles only to avoid privacy issues for PII collection
      • consider whether DNT support is relevant, probably relating to the GDPR module
    • UI improvements. Currently, UI is limited to exposing the node_counter to Views
      • provide a default Views report
      • once longitudinal collection is implemented, provide Views integration
      • once that is done, provide a default Views report
      • support offline rendering, to decouple UI from core workload

Not applicable. Temporary repo until official project is created is hosted at https://github.com/fgm/statistics

Remaining tasks

TBD.

User interface changes

TBD, but at least a default Views page for current stats and later a default Views page for longitudinal stats.

API changes

TBD, but probably a lot.

Data model changes

TBD, but probably a lot. A move to the extended K/V API is likely.

Release notes snippet

TBD.

ckeditor5_table_cell_properties and ckeditor5_table_properties do not work properly for setting a defaultProperties value in the configuration.

$
0
0

Problem/Motivation

It seems that adding defaultProperties does not take effect after saving the content initially. You might notice that it shows the default values initially, but when you save or view the table, you will see that it changes its formatting, causing the content toolbar to not recognize the manually changed values.

Steps to reproduce

Adding to docroot/core/modules/ckeditor5/ckeditor5.ckeditor5.yml the following

ckeditor5_table_properties:
  ckeditor5:
    plugins:
      - table.TableProperties
    config:
      table:
        contentToolbar: [tableProperties]
        tableProperties: 
          defaultProperties: 
            borderStyle: 'double'
            borderColor: 'hsl(0, 0%, 70%)'
            borderWidth: '1px'
            width: '500px'
            height: '100%'

and

ckeditor5_table_cell_properties:
  ckeditor5:
    plugins:
      - table.TableCellProperties
    config:
      table:
        contentToolbar: [tableCellProperties]
        tableProperties: 
          defaultProperties: 
            borderStyle: 'solid'
            borderColor: 'hsl(0, 0%, 75%)'
            borderWidth: '1px'

or using

function my_module_ckeditor5_plugin_info_alter(array &$plugin_definitions) {
  if (isset($plugin_definitions['ckeditor5_table_cell_properties'])) {
    $table_plugin_definition = $plugin_definitions['ckeditor5_table_cell_properties']->toArray();
    $table_plugin_definition['ckeditor5']['config']['table']['tableCellProperties']['defaultProperties'] = [
      'borderStyle' => 'solid',
      'borderColor' => '#000',
      'borderWidth' => '1px',
    ];
    $plugin_definitions['ckeditor5_table_cell_properties'] = new CKEditor5PluginDefinition($table_plugin_definition);
  }
}

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Sticky table header dont work within an element with overflow set (e.g. tabs)

$
0
0

Problem/Motivation

#3362276: Use position: sticky for views sticky table header introduced position: sticky to replace the JS workaround with duplicating the header.

But this technique has currently one big flaw: when placed within e.g. tabs which uses overflow it will not work, as sticky does not go well with overflow set to anything else than visible.

Steps to reproduce

Check out a table within tabs

E.g.:

- install webform module
- enable webform and webform_templates submodule
- go to /admin/structure/webform/templates
- scroll down and check sticky header

Proposed resolution

Either find a workaround or remove overflow from elements like tabs

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


States API doesn't work with multiple select fields

$
0
0

Problem/Motivation

The States API won't pick up the value of a select field with #multiple = TRUE option.

Steps to reproduce:
- Create two fields in a form with the following code:

  $form['dependee'] = array(
    '#type' => 'select',
    '#options' => array(
      'a' => 'Option A',
      'b' => 'Option B',
      'c' => 'Option C',
    ),
    '#multiple' => TRUE,
  );

  $form['dependent'] = array(
    '#type' => 'textfield',
    '#states' => array(
      'visible' => array(
        'select[name="dependee[]"]' => array('value' => array('a')),
      ),
    ),
  );

The dependent field will stay hidden regardless of the value of the dependee. This happens because the value of a multiple select field is an array, and States tries to compare it with the reference with a === operator, which returns always false.

Proposed resolution

Add a handler for arrays in states.Dependent.comparisons. This works with ANDed values:

'select[name="dependee[]"]' => array('value' => array('a', 'b')),

and with ORs as well (following the syntax proposed in #735528: FAPI #states: Fix conditionals to allow OR and XOR constructions):

'select[name="dependee[]"]' => array(array('value' => array('a')), array('value' => array('c')))

Remaining tasks

  1. Land #2702233: [backport] Add JavaScript tests for Form API #states: required, visible, invisible, expanded, checked, unchecked so we have somewhere to put tests for this.
  2. Expand that test to cover this case.
  3. Upload test-only vs. full patch to verify test and fix.
  4. Further reviews/refinements.
  5. RTBC.
  6. Commit to D9/D8.
  7. Open follow-up issue to backport to D7.

User interface changes

This feature finally works as intended:

Before

After

API changes

N/A

Data model changes

N/A

Release notes snippet

TBD.

[Meta] Convert core UI components to use single directory components

$
0
0

Add validation constraints to field_ui.settings

$
0
0

Problem/Motivation

field ui settings has 1 property path that is not yet validatable:

 ./vendor/bin/drush config:inspect --filter-keys=field_ui.settings --detail --list-constraints --fields=key,validatability,constraints 
➜  🤖 Analyzing…

 ---------------------------------------------- ------------- ------------------------------------------ 
  Key                                            Validatable   Validation constraints                    
 ---------------------------------------------- ------------- ------------------------------------------ 
  field_ui.settings                              75%           ValidKeys: '<infer>'                      
   field_ui.settings:                            Validatable   ValidKeys: '<infer>'                      
   field_ui.settings:_core                       Validatable   ValidKeys:                                
                                                                 - default_config_hash                   
   field_ui.settings:_core.default_config_hash   Validatable   NotNull: {  }                             
                                                               Regex: '/^[a-zA-Z0-9\-_]+$/'              
                                                               Length: 43                                
                                                               ↣ PrimitiveType: {  }                     
   field_ui.settings:field_prefix                NOT           ⚠️  @todo Add validation constraints here  
 ---------------------------------------------- ------------- ------------------------------------------ 

Steps to reproduce

  1. Get a local git clone of Drupal core 11.x.
  2. composer require drupal/config_inspector— or manually install https://www.drupal.org/project/config_inspector/releases/2.1.5 or newer (which supports Drupal 11!)
  3. composer require drush/drush
  4. vendor/bin/drush config:inspect --filter-keys=field_ui.settings --detail --list-constraints

Proposed resolution

Add validation constraints to:

  1. field_ui.settings:field_prefix

This requires looking at the existing code and admin UI (if any) to understand which values could be considered valid. Eventually this needs to be reviewed by the relevant subsystem maintainer.

For examples, search *.schema.yml files for the string constraints:😊

Reach out to @borisson_ or @wimleers in the #distributions-and-recipes.

Remaining tasks

  1. field_ui.settings:field_prefix

User interface changes

None.

API changes

Data model changes

More validation 🚀

Release notes snippet

None.

Refactor (if feasible) uses of the jQuery prop function to use vanillaJS

$
0
0

Problem/Motivation

As mentioned in the parent issue #3238306: [META] Where possible, refactor existing jQuery uses to vanillaJS to reduce jQuery footprint, we are working towards reducing our jQuery footprint. One of the ways to accomplish this is to reduce the number of jQuery features used in Drupal core. We have added eslint rules that identify specific features and fail tests when those features are in use.

There are (or will be) individual issues for each jQuery-use eslint rule. This one is specific to jquery/no-prop, which targets the jQuery prop function.

Steps to reproduce

In core/.eslintrc.jquery.json Change "jquery/no-prop": 0, to "jquery/no-prop": 2, to enable eslint checks for uses of jQuery prop(). With this change, you'll be able to see uses of the undesirable jQuery feature by running yarn lint:core-js-passing from the core directory.

Proposed resolution

Replace usage of jQuery.prop with vanilla js alternatives.

Remaining tasks

  • Review MR !4266
  • Close MR !1252

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

Refactor (if feasible) uses of the jQuery ajax function to use Vanilla/native

$
0
0

Problem/Motivation

As mentioned in the parent issue #3238306: [META] Where possible, refactor existing jQuery uses to vanillaJS to reduce jQuery footprint, we are working towards reducing our jQuery footprint. One of the ways to accomplish this is to reduce the number of jQuery features used in Drupal core. We have added eslint rules that identify specific features and fail tests when those features are in use.

There are (or will be) individual issues for each jQuery-use eslint rule. This one is specific to jquery/no-ajax, which targets the jQuery ajax function.

Steps to reproduce

Proposed resolution

Remaining tasks

  • In core/.eslintrc.jquery.json Change "jquery/no-ajax": 0, to "jquery/no-ajax": 2, to enable eslint checks for uses of jQuery ajax(). With this change, you'll be able to see uses of the undesirable jQuery feature by running yarn lint:core-js-passing from the core directory
  • Add the following lines to core/scripts/dev/commit-code-check.sh so the DrupalCI testing script can catch this jQuery usage on all files, not just those which have changed
    # @todo Remove the next chunk of lines before committing. This script only lints
    #  JavaScript files that have changed, so we add this to check all files for
    #  jQuery-specific lint errors.
    cd "$TOP_LEVEL/core"
    node ./node_modules/eslint/bin/eslint.js --quiet --config=.eslintrc.passing.json .
    
    CORRECTJQS=$?
    if [ "$CORRECTJQS" -ne "0" ]; then
      # No need to write any output the node command will do this for us.
      printf "${red}FAILURE ${reset}: unsupported jQuery usage. See errors above."
      STATUS=1
      FINAL_STATUS=1
    fi
    cd $TOP_LEVEL
    # @todo end lines to remove

    Add the block about 10 lines before the end of the file, just before if [[ "$FINAL_STATUS" == "1" ]] && [[ "$DRUPALCI" == "1" ]]; then, then remove it once all the jQuery uses have been refactored.

  • If it's determined to be feasible, refactor those uses of jQuery ajax() to use Vanilla (native) JavaScript instead.

User interface changes

API changes

Data model changes

Release notes snippet

Viewing all 298511 articles
Browse latest View live


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