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

Entity reference field is return node object in node twig template

$
0
0

Problem/Motivation

Entity reference field is return node object in node twig template

Steps to reproduce

  • I have a taxonomy reference field in article content type
  • Then I have overrided the node template and using below code to get the referenced entity in twig
    {% set term_entity= node.field_taxonomy_ref.entity %}
    

    this term_entity variable hold correct object when there is data in field_taxonomy_ref field

  • But when this field field_taxonomy_ref does not have any data then node.field_taxonomy_ref.entity line returning the node object instead of null

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


JSON:API filters are not working on Webform Submissions

$
0
0

Problem/Motivation

I'm not sure if this is an issue of JSON:API or Webform itself, but as Webform Submissions are native Drupal entities my first guess would be it is an issue of JSON:API.

If we try to filter submissions, we always get an empty result:

sorted, but unfiltered:

?include=uid&sort[sort-sid][path]=sid&sort[sort-sid][direction]=DESC


{
  "jsonapi": {
    "version": "1.0",
    "meta": {
      "links": {
        "self": {
          "href": "http://jsonapi.org/format/1.0/"
        }
      }
    }
  },
  "data": [
    {
      "type": "webform_submission--langbewerbung",
      "id": "8c350a2a-ece7-4287-921f-575b6896c539",
      "links": {
        "self": {
          "href": "http://dorea-jb.flow.localhost:8012/jsonapi/submissions/langbewerbung/8c350a2a-ece7-4287-921f-575b6896c539"
        }
      },
      "attributes": {
        "serial": 7039,
        "drupal_internal__sid": 16546,
        "token": "LjHA1b4ORwPu8Q4sxBt1vhk5G9CzW1sU-za_qsKgJvA",
        "uri": "/langbewerbung",
        "created": "2024-05-14T10:25:57+00:00",
        "completed": "2024-05-14T10:27:17+00:00",
        "changed": "2024-05-14T10:27:17+00:00",
        "in_draft": false,
        "current_page": null,
        "langcode": "de",
        "entity_type": null,
        "entity_id": null,
        "locked": false,
// ...

sorted and filtered (test)

?include=uid&sort[sort-sid][path]=sid&sort[sort-sid][direction]=DESC&filter[serial]=7039

{
  "jsonapi": {
    "version": "1.0",
    "meta": {
      "links": {
        "self": {
          "href": "http://jsonapi.org/format/1.0/"
        }
      }
    }
  },
  "data": [],
  "links": {
    "self": {
      "href": "http://dorea-jb.flow.localhost:8012/jsonapi/submissions/langbewerbung?filter%5Bserial%5D=7039&include=uid&sort%5Bsort-sid%5D%5Bpath%5D=sid&sort%5Bsort-sid%5D%5Bdirection%5D=DESC"
    }
  }
}

Steps to reproduce

* install json-api extras module
* Enable the submisssions of a webform
* build a filter url for sid as above

Proposed resolution

The filtering should work as for other entities.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Dependency evaluation for json schema validation

$
0
0

Problem/Motivation

JSON:API uses justinrainbow/json-schema to validate that the responses conform to the {JSON:API} specification. For this to happen:

  • You need core-dev installed.
  • You need assertions enabled (typically via local.settings.php).

The Single Directory Components module, being proposed in #3340712: Add Single Directory Components as a new experimental module, makes further use of this dependencies in the same scenario. In this case it validates the data a component receives, against the schema the component author has written.

Proposed resolution

We want to evaluate adding justinrainbow/json-schema as a dependency of drupal/core. This way we'll be able to do the validation by only enabling assertions.

Additional references:

  1. https://git.drupalcode.org/project/drupal/-/merge_requests/3432#note_160873
  2. https://git.drupalcode.org/project/drupal/-/merge_requests/3432#note_157176
  3. Composer also depends on this package.

[meta] Add constraints to all config entity types

$
0
0

Problem/Motivation

Sibling issue for simple config: #2952037: [meta] Add constraints to all simple configuration.

Now that we have the possibilities to validate configuration we should do that.
This meta issue is about adding constrains to all config entities, so we can use that in JSON:API as well as in configuration entity forms.

The current list of config entity types in core:

  1. core.base_field_override.*.*.*: #3324140: Convert field_storage_config and field_config's form validation logic to validation constraints
  2. field.field.*.*.*: #3324140: Convert field_storage_config and field_config's form validation logic to validation constraints
  3. core.date_format.*: #3397491: Add validation constraints to core.date_format.*
  4. core.entity_view_mode.*.*: #3445150: Add validation constraints to core.entity_view_mode.*.*
  5. core.entity_view_display.*.*.*
  6. core.entity_form_mode.*.*:#3448457: Add validation constraints to core.entity_form_mode.*.*
  7. core.entity_form_display.*.*.*
  8. block.block.*: #3379725: Make Block config entities fully validatable
  9. block_content.type.*: #3397493: Add validation constraints to block_content.type.*
  10. comment.type.*
  11. contact.form.*: #3445976: Add validation constraints to contact.form.*
  12. editor.editor.*: #3412361: Mark Editor config schema as fully validatable
  13. field.storage.*.*: #3324140: Convert field_storage_config and field_config's form validation logic to validation constraints
  14. filter.format.*: #3421946: [PP-2] Make FilterFormat config entities fully validatable
  15. image.style.*: #3447286: Add validation constraints to image.style.*
  16. language.entity.*Not in Standard
  17. language.content_settings.*.*Not in Standard
  18. node.type.*: #3379091: Make NodeType config entities fully validatable
  19. responsive_image.styles.*Not in Standard
  20. rest.resource.*Not in Standard
  21. search.page.*
  22. shortcut.set.*— see #3324984-35: Create test that reports % of config entity types (and config schema types) that is validatable
  23. system.menu.*— see #3324984-35: Create test that reports % of config entity types (and config schema types) that is validatable
  24. system.action.*:#3449259: Add validation constraints to system.action.*
  25. taxonomy.vocabulary.*: #2002174: Allow vocabularies to be validated via the API, not just during form submissions
  26. user.role.*: #3445215: Add validation constraints to user.role.*
  27. views.view.*
  28. workflows.workflow.*: #2920441: Add config validation for workflow entitiesNot in Standard

Total: 8/28=29%
Standard: 8/23=35%

Last updated: May 28, 2024.

Related issues

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Add validation constraints to system.action.*

$
0
0

Problem/Motivation

Action entity is not yet validatable:

vendor/bin/drush config:inspect --filter-keys=system.action.user_cancel_user_action --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                                                                              
 ------------------------------------------------------------------ --------- ------------- ------ ---------------------------------------------------------------------------------------------------- 
  system.action.user_cancel_user_action                              Correct   79%           ✅❓   ValidKeys: '<infer>'                                                                                
   system.action.user_cancel_user_action:                            Correct   Validatable   ✅✅   ValidKeys: '<infer>'                                                                                
   system.action.user_cancel_user_action:_core                       Correct   Validatable   ✅✅   ValidKeys:                                                                                          
                                                                                                      - default_config_hash                                                                             
   system.action.user_cancel_user_action:_core.default_config_hash   Correct   Validatable   ✅✅   NotNull: {  }                                                                                       
                                                                                                    Regex: '/^[a-zA-Z0-9\-_]+$/'                                                                        
                                                                                                    Length: 43                                                                                          
                                                                                                    ↣ PrimitiveType: {  }                                                                               
   system.action.user_cancel_user_action:configuration               Correct   NOT           ✅❓   ❌ @todo Add validation constraints to ancestor type: action.configuration.user_cancel_user_action  
   system.action.user_cancel_user_action:dependencies                Correct   Validatable   ✅✅   ValidKeys: '<infer>'                                                                                
   system.action.user_cancel_user_action:dependencies.module         Correct   NOT           ✅❓   ❌ @todo Add validation constraints to ancestor type: config_dependencies                           
   system.action.user_cancel_user_action:dependencies.module.0       Correct   Validatable   ✅✅   NotBlank: {  }                                                                                      
                                                                                                    ExtensionName: {  }                                                                                 
                                                                                                    ExtensionExists: module                                                                             
                                                                                                    ↣ PrimitiveType: {  }                                                                               
   system.action.user_cancel_user_action:id                          Correct   Validatable   ✅✅   Regex:                                                                                              
                                                                                                      pattern: '/^[a-z0-9_\.]+$/'                                                                       
                                                                                                      message: 'The %value machine name is not valid.'↣ PrimitiveType: {  }                                                                               
                                                                                                    ↣ Length:                                                                                           
                                                                                                      max: 166                                                                                          
   system.action.user_cancel_user_action:label                       Correct   Validatable   ✅✅   Regex:                                                                                              
                                                                                                      pattern: '/([^\PC])/u'                                                                            
                                                                                                      match: false                                                                                      
                                                                                                      message: 'Labels are not allowed to span multiple lines or contain control characters.'           
                                                                                                    NotBlank: {  }                                                                                      
                                                                                                    ↣ PrimitiveType: {  }                                                                               
   system.action.user_cancel_user_action:langcode                    Correct   Validatable   ✅✅   NotNull: {  }                                                                                       
                                                                                                    Choice:                                                                                             
                                                                                                      callback: 'Drupal\Core\TypedData\Plugin\DataType\LanguageReference::getAllValidLangcodes'↣ PrimitiveType: {  }                                                                               
   system.action.user_cancel_user_action:plugin                      Correct   Validatable   ✅✅   PluginExists:                                                                                       
                                                                                                      manager: plugin.manager.action                                                                    
                                                                                                      interface: Drupal\Core\Action\ActionInterface                                                     
                                                                                                    ↣ PrimitiveType: {  }                                                                               
   system.action.user_cancel_user_action:status                      Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }                                                                               
   system.action.user_cancel_user_action:type                        Correct   NOT           ✅❓   ⚠️  @todo Add validation constraints to config entity type: system.action.*                         
   system.action.user_cancel_user_action:uuid                        Correct   Validatable   ✅✅   Uuid: {  }                                                                                          
                                                                                                    ↣ PrimitiveType: {  }                                                                               
 ------------------------------------------------------------------ --------- ------------- ------ ---------------------------------------------------------------------------------------------------- 

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=system.action.user_cancel_user_action --detail --list-constraints

Proposed resolution

Add validation constraints to:

  1. system.action.*:type

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

User interface changes

None.

API changes

None.

Data model changes

More validation 🚀

Release notes snippet

None.

Add validation constraints to user.role.*

$
0
0

Problem/Motivation

User role entity is not yet fully validatable:

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

 ------------------------------------------------ ------------- --------------------------------------------------------------------------------------------- 
  Key                                              Validatable   Validation constraints                                                                       
 ------------------------------------------------ ------------- --------------------------------------------------------------------------------------------- 
  user.role.anonymous                              66%           ValidKeys: '<infer>'                                                                         
   user.role.anonymous:                            Validatable   ValidKeys: '<infer>'                                                                         
   user.role.anonymous:_core                       Validatable   ValidKeys:                                                                                   
                                                                   - default_config_hash                                                                      
   user.role.anonymous:_core.default_config_hash   Validatable   NotNull: {  }                                                                                
                                                                 Regex: '/^[a-zA-Z0-9\-_]+$/'                                                                 
                                                                 Length: 43                                                                                   
                                                                 ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:dependencies                Validatable   ValidKeys: '<infer>'                                                                         
   user.role.anonymous:dependencies.config         NOT           ❌ @todo Add validation constraints to ancestor type: config_dependencies                    
   user.role.anonymous:dependencies.config.0       Validatable   NotBlank: {  }                                                                               
                                                                 ConfigExists: {  }                                                                           
                                                                 ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:dependencies.module         NOT           ❌ @todo Add validation constraints to ancestor type: config_dependencies                    
   user.role.anonymous:dependencies.module.0       Validatable   NotBlank: {  }                                                                               
                                                                 ExtensionName: {  }                                                                          
                                                                 ExtensionExists: module                                                                      
                                                                 ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:dependencies.module.1       Validatable   NotBlank: {  }                                                                               
                                                                 ExtensionName: {  }                                                                          
                                                                 ExtensionExists: module                                                                      
                                                                 ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:dependencies.module.2       Validatable   NotBlank: {  }                                                                               
                                                                 ExtensionName: {  }                                                                          
                                                                 ExtensionExists: module                                                                      
                                                                 ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:dependencies.module.3       Validatable   NotBlank: {  }                                                                               
                                                                 ExtensionName: {  }                                                                          
                                                                 ExtensionExists: module                                                                      
                                                                 ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:dependencies.module.4       Validatable   NotBlank: {  }                                                                               
                                                                 ExtensionName: {  }                                                                          
                                                                 ExtensionExists: module                                                                      
                                                                 ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:dependencies.module.5       Validatable   NotBlank: {  }                                                                               
                                                                 ExtensionName: {  }                                                                          
                                                                 ExtensionExists: module                                                                      
                                                                 ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:dependencies.module.6       Validatable   NotBlank: {  }                                                                               
                                                                 ExtensionName: {  }                                                                          
                                                                 ExtensionExists: module                                                                      
                                                                 ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:id                          Validatable   Regex:                                                                                       
                                                                   pattern: '/^[a-z0-9_]+$/'                                                                  
                                                                   message: 'The %value machine name is not valid.'                                           
                                                                 Length:                                                                                      
                                                                   max: 166                                                                                   
                                                                 ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:is_admin                    Validatable   ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:label                       Validatable   Regex:                                                                                       
                                                                   pattern: '/([^\PC])/u'                                                                     
                                                                   match: false                                                                               
                                                                   message: 'Labels are not allowed to span multiple lines or contain control characters.'    
                                                                 NotBlank: {  }                                                                               
                                                                 ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:langcode                    Validatable   NotNull: {  }                                                                                
                                                                 Choice:                                                                                      
                                                                   callback: 'Drupal\Core\TypedData\Plugin\DataType\LanguageReference::getAllValidLangcodes'↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:permissions                 NOT           ⚠️  @todo Add validation constraints to config entity type: user.role.*                      
   user.role.anonymous:permissions.0               NOT           ⚠️  @todo Add validation constraints to config entity type: user.role.*                      
   user.role.anonymous:permissions.1               NOT           ⚠️  @todo Add validation constraints to config entity type: user.role.*                      
   user.role.anonymous:permissions.2               NOT           ⚠️  @todo Add validation constraints to config entity type: user.role.*                      
   user.role.anonymous:permissions.3               NOT           ⚠️  @todo Add validation constraints to config entity type: user.role.*                      
   user.role.anonymous:permissions.4               NOT           ⚠️  @todo Add validation constraints to config entity type: user.role.*                      
   user.role.anonymous:permissions.5               NOT           ⚠️  @todo Add validation constraints to config entity type: user.role.*                      
   user.role.anonymous:permissions.6               NOT           ⚠️  @todo Add validation constraints to config entity type: user.role.*                      
   user.role.anonymous:status                      Validatable   ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:uuid                        Validatable   Uuid: {  }                                                                                   
                                                                 ↣ PrimitiveType: {  }                                                                        
   user.role.anonymous:weight                      Validatable   Range:                                                                                       
                                                                   min: -2147483648                                                                           
                                                                   max: 2147483647                                                                            
                                                                 FullyValidatable: null                                                                       
                                                                 ↣ PrimitiveType: {  }                                                                        
 ------------------------------------------------ ------------- --------------------------------------------------------------------------------------------- 

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=user.role.anonymous --detail --list-constraints

Proposed resolution

Add validation constraints to missing properties.

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

User interface changes

None.

API changes

None.

Data model changes

More validation 🚀

Release notes snippet

None.

UpdateQuery::arguments() does not return all values.

$
0
0

With reference to #1222150: dpq() only works for SELECT and INSERT queries (a devel module issue), an outstanding issue with the output of its dpq() function on db_update() queries is that the field placeholders are still rendered as the placeholder name, not the value.

e.g. dpq(db_update('node')->fields(array('uid' => 1))->condition('nid', 50)); produces:

UPDATE {node} SET uid=:db_update_placeholder_0
WHERE  (nid = '50') 

With arguments() returning:

Array
(
    [:db_condition_placeholder_0] => 50
)

This is because UpdateQuery::arguments() returns the db_condition_placeholder values, but does not return the db_update_placeholder values.

The reason the query still works is that UpdateQuery::execute() deals with these field placeholders separately; however it access them directly, and no public API analogous to arguments() is provided, so the likes of devel's dpq() have no way of obtaining them.

Now the docstring for arguments() is "Gets a complete list of all values to insert into the prepared statement.", and that's obviously not the case here, but given how the execute method works, I can't tell whether it's the docstring or the code which is incorrect. I can't actually see a reason not to include the field placeholders, though; because...

Unless I'm mis-reading my grep results, I don't think anything in core calls UpdateQuery::arguments() at all? SelectQuery::arguments() is certainly used, and $condition->arguments() is called directly in lots of places, but nothing in my code base save for devel's dpq() seems like it would ever to call this method on an update query.

Experimentally (using code from UpdateQuery::__toString()), if instead of only returning $this->condition->arguments(), I modify UpdateQuery::arguments() like so:

  /**
   * Implements QueryConditionInterface::arguments().
   */
  public function arguments() {
    $args = $this->condition->arguments();

    $fields = $this->fields;
    $max_placeholder = 0;
    foreach ($fields as $field => $value) {
      $args[':db_update_placeholder_' . ($max_placeholder++)] = $value;
    }
    return $args;
  }

Then arguments() returns:

Array
(
    [:db_condition_placeholder_0] => 50
    [:db_update_placeholder_0] => 1
)

and dpq() gives me:

UPDATE {node} SET uid='1'
WHERE  (nid = '50') 

So that seems like a viable solution?

Add Exception for TypeError Argument must be String in \Drupal\Component\Utility\Html escape{}

$
0
0

(Issue summary updated after comments from #17 and below)

Many users report after updating or migrating to a Drupal version like Drupal core 9.5.7 or above, the following error gets reported in different shades of it in detail:

TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string, array given in htmlspecialchars() (line 432 of core\lib\Drupal\Component\Utility\Html.php)

This issue has been modified and converted into a feature request for core handling. The original reporter provided an error output showing that some Views field formatting has caused the error in his case. Others reported to have a WSOD now making the site not maintainable no more caused by other contrib modules.

(Note: Use the patch provided here to make your site operable again and help by uncommenting the check code to find out your individual cause).

Summary

After collecting some user reports it finally turned out soon, that this issue can quickly turn into a misinforming collection basin for the same TypeError message. For different reasons and causes in each of the cases. Reason for this TypeError caused in escape{} is that Arguments of Type Array accidently get handed over to Html.php escape{} and run thru htmlspecialchars(), where Type String is mandatory. Why this happens NOW so often in different individual cases and what has changed so that this collusion happens and suddently becomes obvious in such mass occurance is different in each scenario and should be cleared in the respective issue queues of the subsystems or contrib projects repsonsible for this Array send to escape().

What this issue is now about

How we deal with this flood in core for all upcoming cases to prevent WSOD or sites being unoperable? But keep track on the issue? How to help informing about the reasns and more details about the Array passed since this Error is very generic and tells not much about the root cause. After disussions on Slack I came to the conclusion: What this issue should be about is to add an informal way of dealing with this error in case if Argument is Array like started from #30 and below without interrupting (breaking site/code) since this is not a dangerous issue. First patches provide already the functionality and error handling to make sites operable again. In further discussions it became obviuous: best way would be to add an Exception to deal with this.

Users humbling over this issue by searching for a fix should read carefully from #17 and below how to test what this TypeError has caused in each individual case and should report it in the respective issue queue of the project causing this.

(This starting issue summary has been rcompletely rewritten for the solution oriented context now by @diqidoq in favour of a new issue, to keep track of the initial reports. Thanks for the original report and all the reports helping to find a clear goal for this.)


Trigger a JavaScript deprecation error for dialogClass in forked dialog.js

$
0
0

Problem/Motivation

Follow up from #3296098: Removal :tabbable usage in dialog.js from @catch

figure out what to do with dialogClass

This was deprecated in jQuery UI, but was still in use in various places in core.

I think we should:

1. Remove this entirely in our 11.x fork of jQuery dialog

2. Try to trigger a deprecation error when it's used, either from js or PHP or both, in 10.3.x

Steps to reproduce

N/A

Proposed resolution

TBD

Remaining tasks

Decide what to do
Implement it
Review

User interface changes

N/A

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

Moving project telemetry reporting from the update module into core

$
0
0

Problem/Motivation

The update module (packaged with core) provides a lot of functionality:

  • Reports interface to view a list of modules and themes that are out of date
  • Email notifications when there are updates available
  • Update individual modules and themes by uploading a file via the UI
  • Report usage metrics (telemetry) of installed modules and themes back to Drupal.org

For people that run a large number of sites, especially those that share a common codebase (very common in Higher Ed and Government), it's very common to NOT enable this module, because none of the functionality is needed. As a result, Drupal.org misses out on receiving a lot of telemetry data because it's bundled in this with this module.

Proposed resolution

Separate out the telemetry reporting from the update module and instead bring it into core. I briefly scanned thru the code and didn't see an obvious area where this is being reported, so I think what's happening is that when the module gets its list of extensions and asks Drupal.org for the latest versions of those extensions, Drupal.org registers the usage. So there may need to be some work on Drupal.org's end to faciliate this.

Remaining tasks

Decide if it should be opt-in or opt-out. There's some discussion about this in #2940737: Telemetry initiative.

User interface changes

API changes

Data model changes

Release notes snippet

adding imageStyle:blockRight

$
0
0

Problem/Motivation

Right now CKEditor shows an option to display an image as "block" wrap text, left, center and right, but not a block right (see attached image).

Steps to reproduce

  1. Enable image insertion in CKEditor and enable image align.
  2. Create a node with the appropriate text editor.
  3. The options are Break Text, Align and wrap left, align and break center, align and wrap right, inline
  4. Attempts to add an align and break right with overrides in a module or attempting to patch core do not seem to make the icon option visible.

Proposed resolution

Add an option to allow block right Object Right icon

Contextual filter AND (,) operator for multiple values does not work

$
0
0

In contextual filters, with

  • validator = taxonomy term
  • Filter value type = term ids separated by , or +
  • allow multiple values = true

Giving argument "1+2" works as expected: OR operator
Giving argument "1,2" works as "1+2": OR operator instead of expected AND operator

In both cases, conditions uses operator "IN"
WHERE (( (field_data_field_tags.field_tags_tid IN('1', '2') ) )AND(( (node.status = '1') AND (node.type IN ('flickr_photo')) )))

This is the contextual filter part of my view:

/* Contextual filter: Content: Tags (field_tags) */
$handler->display->display_options['arguments']['field_tags_tid']['id'] = 'field_tags_tid';
$handler->display->display_options['arguments']['field_tags_tid']['table'] = 'field_data_field_tags';
$handler->display->display_options['arguments']['field_tags_tid']['field'] = 'field_tags_tid';
$handler->display->display_options['arguments']['field_tags_tid']['default_action'] = 'empty';
$handler->display->display_options['arguments']['field_tags_tid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['field_tags_tid']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['field_tags_tid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['field_tags_tid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['field_tags_tid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['field_tags_tid']['specify_validation'] = 1;
$handler->display->display_options['arguments']['field_tags_tid']['validate']['type'] = 'taxonomy_term';
$handler->display->display_options['arguments']['field_tags_tid']['validate_options']['vocabularies'] = array(
  'tags' => 'tags',
);
$handler->display->display_options['arguments']['field_tags_tid']['validate_options']['type'] = 'tids';
$handler->display->display_options['arguments']['field_tags_tid']['validate_options']['transform'] = 0;
$handler->display->display_options['arguments']['field_tags_tid']['validate']['fail'] = 'empty';
$handler->display->display_options['arguments']['field_tags_tid']['break_phrase'] = 1;
$handler->display->display_options['arguments']['field_tags_tid']['not'] = 0;

Original summary
---

Title says it all, and per this ticket for Drupal 7:

https://www.drupal.org/project/views/issues/1433622

Claro: Autocomplete dropdown bleeds through sticky table header

$
0
0

Problem/Motivation

Autocomplete dropdown of 'Authored by' search filter shows behind the content list table header.

Steps to reproduce

1. In Drupal 11.x, ensure that the admin content view (/admin/structure/views/view/content) contains the exposed filter criteria for "Authored by".
2. Go to /admin/content page.
3. Search any username in the 'Authored by' filter.
4. Observe the auto-complete behavior.

Proposed resolution

Apply z-index:500; to .ui-front class to fix this issue

Remaining tasks

User interface changes

Before Patch

After Patch

API changes

Data model changes

Release notes snippet

Claro theme loses actions for the view bulk operations form

$
0
0

Problem/Motivation

The Claro theme provides form alter(claro_form_alter) to change the position for the action buttons to make possible a new design for the bulk operations views - https://www.drupal.org/project/drupal/issues/3070558

However, this form alteration provides an issue when the additional action buttons disappear from the form. The reason for this is the code unsets actions array without checking if it contains any other actions except the submit action - https://git.drupalcode.org/project/drupal/-/blob/11.x/core/themes/claro/...

Steps to reproduce

  1. Install modules views_bulk_operations and draggableviews.
  2. Configure a view that uses both modules.
  3. You will find that the view shows only the VBO operation, but hides the "Save order" button for the draggableviews module.

Proposed resolution

At the moment, I think that we can simply move buttons from the "actions" array into "bulk_actions_container".
However, it might require additional changes in styles.

Unable to change menu link parent for unpublished node

$
0
0

Problem/Motivation

I have received complains that an editor can't change a menu item for an unpublished node. While it makes sense to have some sort of basic limitation when revisions aren't handled it's not necessary for unpublished content (the default revision is not published).

Steps to reproduce

Create a node draft with menu item.
OR create a node that's initially published, but then archived.
Create a new draft with changes to menu item parent.

Proposed resolution

Don't validate when the default revision is not published.

Remaining tasks

Review, add tests.

User interface changes

none

API changes

none

Data model changes

Release notes snippet


Add extra page request to the across pages asset performance test

$
0
0

Problem/Motivation

Split from #3437499: [PP-2] Use placeholdering for more elements to optimize asset serving, if we add more pages from Umami, we get a better 'worst case scenario' for the current aggregation / library organisation to improve from.

Steps to reproduce

Proposed resolution

Visit an extra page during these two test methods. Because this loads a different, third, combination of libraries to the first two pages, it results in a different set of asset aggregates and therefore more files and overall bytes being downloaded.

Issues like #3437499: [PP-2] Use placeholdering for more elements to optimize asset serving which attempt to reduce duplication between asset aggregates in this kind of scenario will then be able to show an improvement (or not) based on the existing test scenario.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

[regression] FTPExtension class can no longer connect as of 9.5.x

$
0
0

Problem/Motivation

#3308744: Fix magic connection property access from \Drupal\Core\FileTransfer\FileTransfer::__get() Introduced magic methods to access Drupal\Core\FileTransfer\FTPExtension->connection however now FTPExtension->connect() always throws an exception (which is caught) due to nested calls to __get() .

Error:
Notice: Undefined property: Drupal\Core\FileTransfer\FTPExtension::$connection in Drupal\Core\FileTransfer\FTPExtension->connect() (line 16 of core/lib/Drupal/Core/FileTransfer/FTPExtension.php).

Cannot connect to FTP Server, check settings

Why:
1. Call FTPExtension->connect(); in code.
2. FTPExtension->connect() sets the $connection property
3. $connection is set via parent class FileTransfer's private property $connectionHandle via __set()
4. FTPExtension->connect() then checks if $connection property was set to non-Falsey value.
5. This triggers FileTransfer's __get() which calls FTPExtension->connect()
4. Repeat step 2 ( FTPExtension->connect() sets the $connection property)
5. Repeat step 3 ( $connection is set via parent class FileTransfer's private property $connectionHandle via __set() )
6. Repeat step 4 ( FTPExtension->connect() then checks if $connection property was set to non-Falsey value.)
7. FileTransfer's __get() is not triggered as __get() has already been called in the call stack with the same parameters and so PHP treats it as regular property which is undefined (since the real property is stored in private property $connectionHandle ), so the else condition is triggered which is throwing an exception. (If it didn't it, would be an infinite loop which is equally bad)

Supporting information regarding Zend PHP on nested magic methods.
@see https://github.com/facebook/hhvm/issues/1312

For reference, the PHP behaviour allows calls to magic methods to recurse as long as there isn't an identical call on the stack, this means you can still trigger a magic method from within a magic method as long as the call itself is different.

Steps to reproduce

How to throw the error in custom code:

use Drupal\Core\FileTransfer\FileTransferException;

$data = NULL;
$url = 'ftp://ftp.myserver.com/';
$info = drupal_get_filetransfer_info();
$class = $info['ftp']['class'];
$ftp = $class::factory(DRUPAL_ROOT, [
  'advanced' => [
    'hostname' => parse_url($url, PHP_URL_HOST),
  ],
  'username' => 'anonymous',
  'port' => 21,
]);
try {
  // Login, throws exception if a login error, else defines $ftp->connection.
  // Exceptio nis thrown here.
  $ftp->connect();

  // CODE DOES NOT GET TO THIS POINT, demo purposes to get file content.
  ftp_pasv($ftp->connection, TRUE);
  ob_start();
  if (ftp_get($ftp->connection, 'php://output', parse_url($url, PHP_URL_PATH), FTP_BINARY)) {
    $data = ob_get_contents();
    ob_end_clean();
  }
  ftp_close($ftp->connection);
}
catch (FileTransferException $e) {
  \Drupal::logger()->error($e->getMessage());
  \Drupal::messenger()->addError($e->getMessage());
}

// Echo file data if successful.
if ($data) {
  echo $data;
}

Mock code showing the issue:

class PropertyTest
{
  /**  Location for overloaded data.  */
  private $myPrivate;
  public function __set($name, $value) {
    if ($name == 'myVar') {
    echo "Setting 'myVar' to '$value'\n";
    $this->myPrivate = $value;
    }
    else {
    echo "SET FAILED\n";  
    }
  }
  public function __get($name){
    echo "Getting 'myVar'\n";
    $this->connect();
    return ($name == 'myVar') ? $this->myPrivate : 'GET FAILED';
  }
}

class PropertyTestchild extends PropertyTest {
  public function connect() {
  $this->myVar = 'TEST';
  echo "Parent connect run\n";
  if (!$this->myVar) {
    echo "This property 'myVar' was not set?!\n";
  }
  }
}
echo "<pre>\n";
$obj = new PropertyTestchild();
$obj->connect();
echo "</pre>\n";

Output:

Setting 'myVar' to 'TEST'
Parent connect run
Getting 'myVar'
Setting 'myVar' to 'TEST'
Parent connect run

Warning: Undefined property: PropertyTestchild::$myVar in /home/user/scripts/code.php on line 26
This property 'myVar' was not set?!

Proposed resolution

Only run `connect()` once or revert to previous commit.

One run once dummy code:

class PropertyTest
{
  /**  Location for overloaded data.  */
  private $myPrivate;
  public function __set($name, $value) {
    if ($name == 'myVar') {
    echo "Setting 'myVar' to '$value'\n";
    $this->myPrivate = $value;
    }
    else {
    echo "SET FAILED\n";  
    }
  }
  public function __get($name){
    echo "Getting 'data'\n";
    $this->connect();
    return ($name == 'myVar') ? $this->myPrivate : 'GET FAILED';
  }
}

class PropertyTestchild extends PropertyTest {
  private $hasConnectRun = FALSE;
  public function connect() {
  if ($this->hasConnectRun) {
      return;
    }
    $this->hasConnectRun = TRUE;
  $this->myVar = 'TEST';
  echo "Parent connect run\n";
  if (!$this->myVar) {
    echo "This property 'myVar' was not set?!\n";
  }
  }
}
echo "<pre>\n";
$obj = new PropertyTestchild();
$obj->connect();
echo "</pre>\n";

Output:

Setting 'myVar' to 'TEST'
Parent connect run
Getting 'data'

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Drupal\Component\Plugin\Exception\MissingValueContextException: Required contexts without a value: entity in Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping() (line 150 of web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php

$
0
0

It seems like this problem has been reported multiple times over the years but I wasn't able to find a solution for it.

When editing a product page using layout builder after saving I get the message:

You have unsaved changes.

After click again on layout get a white page with the message:

The website encountered an unexpected error. Please try again later.

and the log messages shows:

Drupal\Component\Plugin\Exception\MissingValueContextException: Required contexts without a value: entity in Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping() (line 150 of web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php

Provide users with the option to select an appropriate moderation state when reverting to a previous revision

$
0
0

Problem/Motivation

When reverting to a previous revision of an item of content, the new revision created matches the moderation state of the revision being reverted.

While this keeps the integrity of the workflow intact, since content can only be recreated in a state that was valid at some previous point in time, it may not always be what users expect and it limits the utility of reverting in general, since certain revisions can only be recreated and immediately published or can only be recreated and reverted back to a draft.

Proposed resolution

A few proposals have been made to address this issue:

@catch in #17 (paraphrasing):

  • Only allow reverts to default revisions
  • Alter the access for the revert action to also require some kind of content_moderation permission
  • Leave it as is, but probably with some messaging

@jhedstrom in #18:

  • Could we simply add the moderation select list to the revert confirmation form?

@Sam152 in #30:

  • Building on adding a moderation select list to the revert screen, but introducing additional permissions for reverting to each state.

Remaining tasks

Agree and implement an approach.

User interface changes

API changes

Data model changes

Provide a NavigationLinkBlock Plugin and use Help as an usage example

$
0
0

Problem/Motivation

Providing a Single Link Navigation Block type could be useful for situations where a single item needs to be added to navigation and creating a new menu just for this purpose would be overkill and complex for editors.

A good example of this is the Help link in the current navigation. This is a single link and it was hardcoded in the NavigationUserBlock to avoid creating an extra menu.

If we add this new item, we could migrate Help link to be an usage of this block type and significantly simplify logic in NavigationUserBlock.

Related issues where complexity could be reduced:

#3441576: Investigate using the core "User account menu" in favor of custom Navigation Block for same
#3441118: [PP1] Add the user image to the user menu when available

Steps to reproduce

Current process to add a single link to page Foo in navigation:

  1. Go to Add Menu Page and create and arbitrary menu called Bar
  2. Edit the Bar menu and add menu item to Foo and its title
  3. Go to Navigation Layout page and add a new Bar Menu block
  4. Configure the Bar Menu Block to use 1st level and depth of 1
  5. Link to Foo is added to Navigation

Proposed resolution

Proposed flow to create a single link to Foo page to Navigation:

  1. Go to Navigation Layout page and add a new Link block
  2. Configure the Link block entering Foo route and title (Icon to be discussed)
  3. Link to Foo is added to Navigation

For now, this new block type will not be available to be added via UI. But created to make the work on the related issues smoother.

Remaining tasks

Discuss the approach

User interface changes

None. While we added a new Link block here, it is presently hidden from the general Block layout page as well as the Navigation layout page.

API changes

A new block with machine name navigation_link was added.

Data model changes

None.

Viewing all 300130 articles
Browse latest View live


Latest Images

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