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

Indirect modification of overloaded element with Views responsive table

$
0
0

Problem/Motivation

When you enable priorities in the Views UI under Table settings, it begins to trigger PHP warnings, along the lines of:

Notice: Indirect modification of overloaded element of Drupal\Core\Template\Attribute has no effect in template_preprocess_views_view_table() (line 555 of core/modules/views/views.theme.inc).

Proposed resolution

Merge into an attribute object.

Remaining tasks

  • Add test coverage

Convert custom path alias forms to entity forms

$
0
0

Problem/Motivation

After path aliases are converted to entities, we should also convert their forms to extend content entity form base classes.

Proposed resolution

Convert custom path alias forms to entity forms.

Remaining tasks

Do it :)

User interface changes

Nope.

API changes

Nope.

Data model changes

Nope.

Label (Title) not set for Views block (exposed filters in Block)

$
0
0

Problem/Motivation

When using a views exposed form as block. The block does not allow you to provide a title.

Proposed resolution

Patch provided

Remaining tasks

  • Add test coverage for the bug
  • Write the upgrade path Reviewed in #61, and re-factored in #66
  • Manually test for the upgrade path#57
  • Update the change record (see #52)
  • Write upgrade path tests#68

User interface changes

None

API changes

None

Data model changes

None

Original Summary

I have created a simple Views page with several exposed filters with Views option: Exposed form in block: Yes.
The block is configured to "Display title" in block config settings.
When the block is configured to display in a region, the Label/title is not displaying.
I have dumped the block variables out with template_preprocess_block() and label key is empty ('label' => string(0) "").
The result is the same when the block is configured to override title.
Is this a bug or have I missed something?

drush config:set for other than default collections raises exception

$
0
0

Problem/Motivation

Trying to set language specific config, for example Spanish site name:

$ drush -y config:set language.es:system.site name "Hola Mundo"

Raises the following exception:

Invalid character in Config object name language.es:system.site.

Whereas the following two commands just work fine:

$ drush config:get language.es:system.site name
'language.es:system.site:name': 'Hello World'
$ drush -y config:set system.site name "Hello World"
 // Do you want to update name key in system.site config?: yes.

Proposed resolution

in core/lib/Drupal/Core/Config/ConfigBase.php inside public static function validateName($name) the following

    // The name must not contain any of the following characters:
    // : ? * < > "' / \
    if (preg_match('/[:?*<>"\'\/\\\\]/', $name)) {
      throw new ConfigNameException("Invalid character in Config object name $name.");
    }

may better be

    // The name must not contain any of the following characters:
    // : ? * < > "' / \
    // Except for language-specific collections.
    if (!preg_match('/^language.[a-z]{2}:/', $name)) {
      if (preg_match('/[:?*<>"\'\/\\\\]/', $name)) {
        throw new ConfigNameException("Invalid character in Config object name $name.");
      }
    }

to exclude at least language-specific collections from invalid character check. Although I'm not sure if it's not even better to make that a more general solution, for example if there are other collections than language collections. But are or can be there any other collections except language collections?

Remaining tasks

* patch provided
* reviews needed
* tests to be run
* documentation to be written

User interface changes

- None -

API changes

Unsure about that.

Data model changes

- None -

Fix the documentation for entity load hooks

$
0
0

Problem/Motivation

While working on #2616814: Delegate all hook invocations to ModuleHandler, we discovered that workspaces_entity_load() takes its $entities argument by reference, which violates the hook_entity_load() interface.

Proposed resolution

Introduce hook_entity_load_alter() to directly solve the problem in the Workspaces module, and hook_ENTITY_TYPE_load_alter() to make this alteration behavior consistent with the other entity API hooks.

Remaining tasks

None.

User interface changes

None.

API changes

None. These are additions only.

Data model changes

None.

Allow sorting nested properties of config entity queries

$
0
0

Problem/Motivation

Currently it does not seem to be possible to sort a config entity query through the third party settings.

return $this->getQuery($this->keys, $this->category, $this->state)
    ->sort('third_party_settings.custom_module.last_updated', 'DESC')
    ->execute();

This seems to be because the execute() method of \Drupal\Core\Config\Entity\Query\Query does not handle nested properties in the way the conditions on the query are handled.

Proposed resolution

Parse fields in the same way the conditions for the config entity queries are handles (so split the field by dot).

Remaining tasks

Discuss the solution, add some tests.

User interface changes

API changes

Data model changes

Convert tablesort.inc functions to a static class

$
0
0

Followup #2999721: [META] Deprecate the legacy include files :

Problem/Motivation

Convert tablesort.inc functions to a static class.

Proposed resolution

Implement table_sort service and deprecate all tablesort.inc provided functions

Remaining tasks

  • Convert content into static class
  • Deprecate functions in tablesort.inc
  • Replace deprecated functions with the static method calls
  • Create and fill CR to highlite deprecation of the tablesort.inc file
  • Add legacy test for deprecated functions
  • Prepare all external dependencies to static calls (translation, render, request)

User interface changes

None.

API changes

tablesort_* functions will be deprecated and removed at Drupal 9 release.
Will be introduced a new static TableSort class.

Data model changes

None.

Remove remaining usages of entity_view

$
0
0

The entity_view function has been deprecated for some time now and only used in a couple of places. Let's go the home stretch, remove the final usages from core and trigger a deprecation warning when the method is called by implementing modules.


Remove remaining usages of entity_view_multiple from core

$
0
0

The entity_view_multiple function has been deprecated for some time now and only used in 8 places. Let's go the home stretch, remove the final usages from core and trigger a deprecation warning when the method is called by implementing modules.

Add an argument to Token::replace() to disable escaping

$
0
0

Problem/Motivation

Follow-up of #2567257-210: hook_tokens() $sanitize option incompatible with Html sanitisation requirements:

Posting this here for now, will probably open a follow-up issue.

I've been working on updating token.module and adjusting functionality/tests for this. Which is probably something we should have done before committing this, to make sure that this works for more than the few use cases that core has.

I think there is at least one example there why supporting some sort of sanitize => FALSE is useful and important.

The basic use case is when you have user-provided, unsafe input and want it to be continue unsafe and un-escaped, because you then rely on autoescape.

One example in token.module is the block label, it has this code:

function token_block_view_alter(&$build, BlockPluginInterface $block) {
  $config = $block->getConfiguration();
  $label = $config['label'];
  if ($label != '<none>') {
    // The label is automatically escaped, avoid escaping it twice.
    $build['#configuration']['label'] = \Drupal::token()->replace($label, array(), array('sanitize' => FALSE));
  }
}

The problem is that now the block label tokens are escaped twice. There's a test that is creating a node with a ' in it, and right now, that is getting escaped twice (which is exactly what this code is testing), since we force-escape all token return values and then escape the whole string again.

I don't see a proper way to fix this right now. What technically works is using PlainTextOutput::renderFromHtml() but clearly it is not correct to use that in non-plaintext output.

We don't have to pass it to hook implementations, but I really think we need a flag to prevent auto-escaping. We even document:
The caller is responsible for choosing the right escaping / sanitization but don't actually allow to caller to do that, at least not for token values. But if the token input is untrusted and will be escaped later, we must treat token replacements as untrusted too or we are guaranteed to have double-escaping problems?

(See also the following comments about some discussion and why various things don't work IMHO)

Proposed resolution

Add an option that does nothing but skip the Html::escape() and always returns the token value as-is.

It does *not* pass that through to hook implementations. To make it clear that it is not the same as the old sanitize option, it should probably be named differently, e.g. 'escape' => TRUE/FALSE, defaulting to FALSE.

Remaining tasks

User interface changes

API changes

Data model changes

Add a hook_entity_preload() for modules that need to load a different revision than the default one

$
0
0

Problem/Motivation

Some modules need to act before an entity is loaded, and swap out the default revision with a different one.

For example, the Workspace module in core swaps the default revision with a workspace-specific revision, if one exists.

Proposed resolution

Add two new hooks: hook_entity_preload() and hook_ENTITY_TYPE_preload() that are called before the entity loading process.

Remaining tasks

Discuss, review.

User interface changes

Nope.

API changes

API addition, the two new hooks mentioned above.

Data model changes

Nope.

Replaces usages of entity.query service in entity query tests

Lock FieldableEntityStorageInterface down

$
0
0

The annotation for /core/lib/Drupal/Core/Entity/FieldableEntityStorageInterface::countFieldData()

specifies the type for $storage_definition.

but the function definition does not. I like strongly typed interface definitions.

I think we are missing an obvious trick.

ValidReferenceConstraintValidator should not try to enforce data integrity on pre-existing references

$
0
0

Problem:

Nodes are not saving with inaccesible pre-existing referenced items.

Issue has been fixed once with the ticket: https://www.drupal.org/project/drupal/issues/2791269 stating, "Allow saving pre-existing references to inaccessible items" means there should not be any validation check for the existing referenced items.

Still the node save was disallowed and throwing an exception : "This entity (node: 32) cannot be referenced."

On cheking deeper the solution contains a condition:

/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ValidReferenceConstraintValidator.php
@@ -119,32 +119,31 @@ public function validate($value, Constraint $constraint) {
+          // Check if any of the invalid existing references are simply not
+          // accessible by the user, in which case they need to be excluded from
+          // validation
+          if (isset($previously_referenced_ids[$target_id]) && isset($existing_entities[$target_id]) && !$existing_entities[$target_id]->access('view')) {
+            continue;
+          }

Accordingly, the clause !$existing_entities[$target_id]->access('view') is causing problem in my casue.

Steps to reproduce

  • Create a content type with an entity reference field, able to reference the same content type.
  • Give a test user access to edit all content of that type + "view own unpublished content".
  • Create an unpublished node using user "test user".
  • Create another node referencing the unpublished node. using user "test user"
  • As the test user, edit the second node. Notice the reference field says “- Restricted access - (1)”
  • Try saving the node, get an “This entity (node: 1) cannot be referenced.” error.

here, the condition is failing becasue the "test user" has "view access" for the referenced unpublished node ceated by himself.

It is not only the problem with "view own unpublished content" permisisons. When you have any other Node access module enabled like Domain Access or content modertion. The issue get more severe and requires a broader scope.

Becasue user will be editing a node shared on different domains consisting different doamins (assigned) entity references.

Required solutions

  1. The scope of the validation check should be defined.
    • When the items should be validated - pre-existing or new ?
    • Should validate existing items in case of deleted entites ?
    • What is overall requirement of the validations ?
  2. Remove the "view access" condition ? And add other conditions depending upon the anwser of above point.

iFrame Domain security setup question

$
0
0

I'm still working on getting used to D8 since moving from D7. I keep noticing the notice that I should take care of a security risk about display oEmbed content in a frame that is served from the same domain as your main Drupal site. I go to the page at admin/config/media/media-settings, but I am lost as to what I'm supposed to do. I read the links about what the problem is, but what am I supposed to put in the form box? It kind of makes it sound like I'm meant to set up another domain to point to my main one. Is that it?


Add views language filter fallback, if node not in language of filter: show in source, show in X, hide

$
0
0

Updated: Comment #0

Problem/Motivation

#2161845: Node views (front page, admin) do not use the proper language filter is not quite the expected behavior.

If
node 1 is in en (source), es, af
node 2 is in es (source)
node 3 is in af (source), en

And people create a view (like the front page) which is "List all the nodes in the page's current language",
the expected result is to see 3 nodes (all the nodes). Assumes fallback, see list in proposed resolution section, is show node in source language.

If the page language is en, then expected is: node 1 in en, node 2 in es, node 3 in en, is expected. (Optional expectation is that users with translation permission could see a link to translate node 2 into en. Separate issue?)

If the page language is es, then expected is: node 1 in es, node 2 in es, node 3 in af.

Proposed resolution

Add fallback to language filter, with choices of what to do when there is a result, but not a result in the language being filtered by.

Fallback choices could be:
a) show node in source language (the "language of the node", note that nodes do not have to exist in the site default. For example a site default might be en, but a node, like node 2 above could have been created in es, or node 3 created in af)
b) show node in site default language
c) show node in X language detection and negotiation method... like user account preferred language, browser language
d) hide node.

Remaining tasks

  • Decide what is actually expected, or common use cases.
  • Decide if this is core or contrib territory.
  • After done here, might have to return to make another issue to update the default front page view.
Contributor tasks needed
TaskNovice task?Contributor instructionsComplete?
Update the issue summaryInstructions
Update the issue summary noting if allowed during the betaInstructions

User interface changes

No?

API changes

No?

Provide a token for the site's base URL

$
0
0

Hi,

my multilanguage site is configured to show language prefixes on paths, but didn't expect to see the language prefix in the value of the[site-url] token too, and it seems it is not possible to pass options for the global tokens either in token_token_values().

To prevent the language prefix from showing in the url, we can use this snippet

$values['site-url']     = url('<front>', array('absolute' => TRUE, 'language' => ''));

Let me know if the change looks OK to you, in this case I can send a proper patch.

Thanks,
Antonio

Remove Drupal 6 migration plugins to contrib in D9

Can't create comments when comment is a base field

$
0
0

I added a Base Field of type 'comment' to a content entity type.

When adding a comment into the comment form, I got an error from Comment::preCreate() that FieldStorageConfig is not an object.
I'm guessing that base fields don't use FieldStorageConfig?

Custom node operations

$
0
0

Is there anyway to define a custom node operation ?

This could be helpful for a clone op, for example, where the user can't update the original node, but has more possibilities than just viewing it.
Such an op should, of course, then be available to all access hooks such as hook_node_access, hook_node_grants and hook_node_access_records.

Viewing all 294402 articles
Browse latest View live


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