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

Asset library DX: Non-helpful fatal error if CSS isn't nested under an existing category

$
0
0

Problem/Motivation

If a developer is adding a CSS library, and forgets to nest the assets under one of the existing categories (component, theme, etc), the following error is thrown:

Error: Cannot use assign-op operators with overloaded objects nor string offsets in Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension() (line 138 of core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php).

this happens, for instance, with the following (incorrect) code in foo.libraries.yml:

bootstrap-cdn:
  remote: http://getbootstrap.com
  version: 3.3.6
  license:
    name: MIT
    url: https://github.com/twbs/bootstrap/blob/master/LICENSE
    gpl-compatible: false
  css:
    https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css: { type: external, minified: true }
  js:
    https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js: { type: external, minified: true }
  dependencies:
    - core/jquery

Note the CSS needs to be nested like so:

...
  css:
    theme:
      https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css: { type: external, minified: true }

Proposed resolution

Add an assertion to make sure $options is an array.

Remaining tasks

User interface changes

API changes

Data model changes


Extend ContactAuthenticatedUserTest for anonymous user

$
0
0

Updated: Comment #0

Problem/Motivation

The test makes sure that there's no name and mail fields for authenticated user but no check for this fields for anonymous user

Proposed resolution

Extend this test to check that this fields present for anonymous

Remaining tasks

create patch ;)

User interface changes

no

API changes

no

Convert TrackerUserUidTest web tests to browser tests

Using BIGINT instead of INT in custom entity

$
0
0

Problem/Motivation

I have the following requirement: I have existing data (old system) and they need to be imported to Drupal (new system).

I have programmatically created a custom entity. This custom entity contains different field definitions. Some of them they have setCardinality = FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED

I was able to change the size of the ID of the entity from INT to BIGINT by adding the following code to my entity class:

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = parent::baseFieldDefinitions($entity_type);

    if ($entity_type->hasKey('id')) {
      $fields[$entity_type->getKey('id')] = BaseFieldDefinition::create('integer')
        ->setLabel(new TranslatableMarkup('ID'))
        ->setReadOnly(TRUE)
        ->setSettings(['unsigned' => true,'size' => 'big'
        ]);
    }

    $fields['type'] = BaseFieldDefinition::create('list_string')
      ->setLabel(t('Type'))
      ->setRevisionable(true)
      ->setRequired(true)
      ->setDisplayOptions('form', ['type' => 'options_select','weight' => 0
      ])
      ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
      ->setSetting('allowed_values', ['a' => 'Type A','b' => 'Type B','c' => 'Type C'
      ])
      ->setDisplayConfigurable('form', true);
    ...
}

The second field type will contain data in his own table and Drupal will take care about the relation between both tables:
Entity (navigation) and the type table (navigation__type)

Question

How can I chang the size from INT to BIGINT in table navigation__type of column entity_id? Is there any solution or can someone give me a hint?

I apprechiate any input :)
thanks

Avoid a useless variable initialization in UserData::set()

$
0
0

API page: https://api.drupal.org/api/drupal/core%21modules%21user%21src%21UserData...

UserData::set() uses the following code.

public function set($module, $uid, $name, $value) {
  $serialized = 0;
  if (!is_scalar($value)) {
    $value = serialize($value);
    $serialized = 1;
  }
  $this->connection->merge('users_data')
    ->keys(['uid' => $uid,'module' => $module,'name' => $name,
    ])
    ->fields(['value' => $value,'serialized' => $serialized,
    ])
    ->execute();
}

It is setting $serialized twice, when its value depend from the value returned from a PHP function. The following code does the same without setting twice that variable.

public function set($module, $uid, $name, $value) {
  $serialized = (int) !is_scalar($value);
  if ($serialized) {
    $value = serialize($value);
  }
  $this->connection->merge('users_data')
    ->keys(['uid' => $uid,'module' => $module,'name' => $name,
    ])
    ->fields(['value' => $value,'serialized' => $serialized,
    ])
    ->execute();
}

I casted the value to an integer, since the original code is using 0 and 1. It could be removed, if the code still works also with boolean values.

Add last 'changed' property to user entity

$
0
0

The users table contains a 'created' column but no 'modified' column. It would be useful to know when a row in the table was last modified to help with things like synchronization and auditing.

Example use case:
Say you want to export a list of all users who were either new to the system or who had changed their email address, on or after a given date (for example the date of a previous export). Without a 'modified' column, it's impossible to know if the 'mail' column has been modified since the user was created.

This means that we can't just export a list of new/updated users to an external system, but have to export ALL user records and check each one to make sure it's not a duplicate before importing to the external system. If the external system only supports CSV imports and doesn't have in-built duplicate checking, this becomes quite a pain because it requires doing an export from the external system first, and comparing the lists to remove duplicates. Even if the external system does have duplicate checking, it requires a larger upload file and unnecessary processing time.
---

It seems like it would be easy enough to add a 'modified' column and have the Drupal user module update it any time an update is made to a row in the users table.

In addition to the use case above, it could be useful for other synchronization scenarios as well.

Remove sourceMap clean up code

$
0
0

Problem/Motivation

Background: #2400287: Remove all occurences of sourceMappingURL and sourceURL when JS files are aggregated

Most of the modern browser won't display sourceMap error on Console anymore.

No Error Report:
- Chrome
- Firefox
- IE 11
- Edge

With Error Report:
- Safari 10

And sourceURL syntax is deprecated a long while.

Proposed resolution

- Remove the clean up
- At least, use strpos before preg_replace for faster performance?

Remaining tasks

User interface changes

API changes

Data model changes

Remove whitespace modifiers from links.html.twig

$
0
0

The template file links.html.twig has a lot of whitespace modifiers. These dashes here, {%- if heading -%}

They were originally added when the template was converted, but don't seem to serve a purpose and can be removed. They might have been there originally for tests but joelpittet confirmed they aren't needed for that now. See the patch here, https://www.drupal.org/node/2465399#comment-9829099

If they can be removed, remove them from the template in the System module, and the template in Classy. To determine if they can be removed we need to look for any instances where links might be rendered inline. That is a place where whitespace could be an issue.

Also, this template has a wrapping if statement:

{% if links -%}
...
{%- endif %}

The if was a direct copy of functionality from when this was a theme function. We cannot verify why it is still needed. Investigate whether it can be removed, and, if so, remove it.

If this issue is worked on after #2455211: Comment field displayed last regardless of assigned weight gets committed, investigate removing the if from the links template in Bartik, as well.

Update : Made the changes in the core links.html.twig template to fix the white-spaces issue as mentioned by Cottser
https://www.drupal.org/node/2472591#comment-10878510

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue categoryTask because it's not broken, just minor cleanup to the template
Issue priorityNormal, this only changes the appearance of the template code and whitespace in markup.
Unfrozen changesUnfrozen because it only changes templates.
DisruptionNot disruptive at all.

Bubbling of elements' max-age to the page's headers and the page cache

$
0
0

Problem/Motivation

When I set a certain block to be cached for up to e.g. 15 minutes, then I expect that the containing page also emits a corresponding header. And I also expect Drupal's page cache to honor this.

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

None.

API changes

None.

Add a core/CODE_OF_CONDUCT.txt to conform to Github recommendations

$
0
0

Problem/Motivation

Github recently added new community tools which lints projects for their own open-source community recommendations, one of which is to "add a CODE_OF_CONDUCT file in your repository".

Proposed resolution

Add a core/CODE_OF_CONDUCT.txt to Drupal's repository, with the contents of Drupal's code of conduct.

I suggest putting it in whichever folder holds MAINTAINERS.txt (i.e.: another piece of documentation you'd probably want to read if you wanted to interact with the Drupal community). In Drupal 8, MAINTAINERS.txt is in the core sub-directory; in Drupal 7 MAINTAINERS.txt is in the root folder.

I suggest we make it a .txt (as opposed to a markdown document / .md) to be consistent with other documentation in that directory.

I suggest we use the text from https://www.drupal.org/dcoc (as opposed to the DrupalCon Code of Conduct) because someone contributing would have to do so through drupal.org anyway (i.e.: not necessarily DrupalCon).

Remaining tasks

  1. Write a patch
  2. Review and feedback
  3. RTBC and feedback
  4. Commit
  5. Discuss how to backport to 7.x

User interface changes

None.

API changes

None.

Data model changes

None.

EntityResource: Provide comprehensive test coverage for DateFormat entity

$
0
0

Make QuickEditEntityFieldAccessCheck::access() use the $account that's passed in

$
0
0

EditEntityFieldAccessCheck::access() receives a $account argument, but doesn't pass it to accessEditEntityField(), so it also doesn't get passed to $entity->access() and $entity->get($field_name)->access(). As a result, the access gets checked for the currently logged in user rather than the injected one. This would be a critical bug if there were a known use case for needing to check access to this route for someone other than the current user, but without such a known use case, this is just a normal task.

Improve timezones selector with optgroups

$
0
0

Problem/Motivation

When selecting a timezone you have to choose from a list of 422 items. Quickly finding an entry in this list can be difficult as you have to look through options with the same region and typing city names does not work.

Proposed resolution

Group the options by region, listing the city so that typing will select the appropriate entry.

User interface changes

The list of timezones in the widget will change to be a list of cities, and not timezone names.

Before:
Before screenshot. Cities in the timezone combobox are prefixed with their continent.
After:
After screenshot. Options in the timezone combobox are just city names. Continent names are used as option groups.

Remaining tasks

  • Needs Before and after Screenshots. DONE, comments #2 and #18.
  • Needs Accessibility Review. DONE, comment #19
  • Needs Usability Review DONE, comment #34
  • Needs patch updated to address comment #65 - DONE, patch #72 fixed those.
  • Needs automated tests - See comments #63 to #66. - DONE, patch #77
  • Approve API addition. Needs confirmation that it is backwards-compatible.
  • Needs change record for the API addition.

API changes

Adds an optional new $grouped = FALSE parameter to system_time_zones(). If true, the timezones are returned with an additional level of nesting, grouped by continent.

Data model changes

None.

BigPipe changes CSS evaluation order

$
0
0

After upgrading to Drupal 8.3.3 from 8.2.8 and enabling the BigPipe module the custom CSS in my theme for my exposed filter form in a block had changed priority. I had attached the CSS in the TWIG template views-exposed-form--VIEW--page-1.html. Without the BigPipe module, the CSS attached via the TWIG template was evaluated last. With BigPipe, the behavior is dependent on whether or not a user is logged in or not. When not logged in, the behavior is the same as without BigPipe. When a user is logged in and BigPipe is activated, other CSS is evaluated after the CSS attached on the TWIG template.

To reproduce this bug:
1. Create a theme using Adaptive Theme. (This step might not be necessary, I have not tested it.)
2. Create some custom CSS within the theme. (I used input.class)
3. Attach the CSS to a TWIG template that overrides a views-exposed-form.
4. Enable the BigPipe module.

I am running Windows 10. This is a Drupal 8.3.3 installation running on Apache 2.4.18 with PHP 7.0.15 and MySQL 5.7.17 running on Ubuntu 16.04. This is running on a Vagrant Virtual Machine, bento/ubuntu-16.04 v2.3.4, on my Windows 10 machine. This was tested using Chrome 58.0.3029.110 (64-bit).

Remove Install new module or theme button from Available updates report

$
0
0

The Available updates report at /admin/reports/updates reads at the top:

Here you can find information about available updates for your installed modules and themes. Note that each module or theme is part of a "project", which may or may not have the same name, and might include multiple modules or themes within it.

Install new module or theme (button)

If you click the button, you cannot use the page Install /admin/reports/updates/install to accomplish any updates.

I suggest removing this button, or replacing it with a button "+Updates" which goes to /reports/updates/update.


make ip_address in D7 overrideable (AWS has ip rangesfor proxies)

$
0
0

At the moment We should either
- patch core to enable ip ranges in the "reverse proxy ip addres array" in the settings file
or
- patch core so people can write their own function to do something like this.

At the moment our D7 install on AWS (cloudfront - elastic beanstalk) passes on IP's but we need to check this to a synamic list of ranges , or do an other logic to check if these are valid ip's.

Therefor we would like to be able to override this function in D7.

A patch suggestion added:

function ip_address() {
  $ip_address = &drupal_static(__FUNCTION__);

  if (!isset($ip_address)) {
    $ip_address = $_SERVER['REMOTE_ADDR'];

    if (variable_get('reverse_proxy', 0)) {

+      $ip_add_func = variable_get('reverse_proxy_ip_func', false);
+      if ($ip_add_func && function_exists($ip_add_func)){
+        $ip_address = call_user_func($ip_add_func);
+      }

...

Change content-types, comment-types, and block-types URLs

$
0
0

Problem/Motivation

Comment types are managed at :
/admin/structure/comment
and edited at
/admin/structure/comment/manage/[xxx]
This feels wrong as a user because it is not about a single comment but about comment-types in general, thus comment in url should be change to comment-types.

Content types are managed at :
/admin/structure/types
and edited at
/admin/structure/types/manage/[xxx]
This feels wrong as a user because it is about node types. Types is to vague : node types ? comment types ? Thus types in url should be change to node-types.

Block types are managed at :
/admin/structure/block/block-content
and edited at
/admin/structure/block/block-content/manage/[xxx]
This feels wrong as a user because it is about blocks types. We have the concepts of types for content and comments, and here we use block-content concept for what is basically a block type. Thus block_content in url should be change to block-types since this actually maintain homogeneity in concepts.

Proposed resolution

Change URLs as following :

For content-types :

  • /admin/structure/types to /admin/structure/content-types
  • /admin/structure/types/add to /admin/structure/content-types/add
  • /admin/structure/types/manage/{node_type} to /admin/structure/content-types/manage/{node_type}
  • /admin/structure/types/manage/{node_type}/delete to /admin/structure/content-types/manage/{node_type}/delete

For comment-types :

  • /admin/structure/comment to /admin/structure/comment-types
  • /admin/structure/comment/types/add to /admin/structure/comment-types/add
  • /admin/structure/comment/manage/{node_type} to /admin/structure/comment-types/manage/{comment_type}
  • /admin/structure/comment/manage/{node_type}/delete to /admin/structure/comment-types/manage/{comment_type}/delete

For block-types :

  • /admin/structure/block/block-content/types to /admin/structure/block-types
  • /admin/structure/block/block-content/types/add to /admin/structure/block-types/add
  • /admin/structure/block/block-content/manage/{block_content_type} to /admin/structure/block-types/manage/{block_content_type}
  • /admin/structure/block/block-content/manage/{block_content_type}/delete to /admin/structure/block-types/manage/{block_content_type}/delete

Remaining tasks

  • The issue needs a usability signoff.
  • Discuss the positive impact of this change vs. breaking existing links that do not use routes (e.g. in content and maybe other cases).
Contributor tasks needed
TaskNovice task?Contributor instructionsComplete?
Update the issue summary noting if allowed during the betaInstructions
Review patch to ensure that it fixes the issue, stays within scope, is properly documented, and follows coding standardsInstructions

User interface changes

None apart from URLs.

API changes

None

Reference: https://www.drupal.org/core/beta-changes
Issue categoryTask because it is about improving URLs consistancy along Drupal Core.
Issue priorityNormal because it is renaming of URLs, thus has isolated impact.
Prioritized changesThe main goal of this issue is usability and accessibility because URLs would be more consistent for a user.
DisruptionShould not be disruptive more contributed modules unless they uses the URLs for WebBase tests as Simplify module does. Disruptive for existing sites if these have existing links for these paths that do not use routes (e.g. in content fields and maybe other cases).

Deploying Twig template changes is too expensive: it requires all caches to be completely invalidated, as well as all reverse proxies

$
0
0

Problem/Motivation

In #2752961: No reliable method exists for clearing the Twig cache we're evaluating how to reliably clear the Twig cache upon deploying to production in a multi webheads environment. To achieve that, the proposed resolution involves rebuilding Drupal caches and invalidating all URLs with the rendered cache tag if there's e.g. Varnish and/or a CDN in front.

Since Drupal 8 caches a lot more things than Drupal 7 and cache tags now allow changes to show up immediately on a site, even with Varnish or a CDN is in front (see the Purge API refactoring for D8), it's a shame we have to resort to such expensive operations when e.g. only a minor cosmetic change is made to a Twig template.

Proposed resolution

Upon deploying to production, we should find a less expensive way to only clear out what really needs to be cleared (e.g. render cache) and also make it easy for e.g. contrib to hook into Drupal and invalidate the rendered tag (or any other tag that would make sense and ideally be less 'global') when a cache rebuild has been initiated.

Remaining tasks

Discuss and evaluate options.

User interface changes

None.

API changes

None anticipated.

Data model changes

None.

Make the HTML wrapper tag for media items more semantically correct

$
0
0

This issue is spun off from #2831274-390: Bring Media entity module to core as Media module, specifically this point of review:

Twig templates use ? https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article - I don't think that media items should wrapped in that.

phenaproxima: Open to suggestions here, but not sure what a more appropriate tag would be.

seanB: It’s either this, or a plain old div I believe. I think perfectly described that a media item is a ‘self-contained composition in a document’ and ‘independently distributable or reusable’.

alexpott: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article the aria roles that are related really do not make me think this is at all related to what is in media and when you put a media entity on a node using entity reference it's going to be wrapped in article tags - inside another article - seems weird.

This is postponed on #2831274: Bring Media entity module to core as Media module.

When using protocol-less url no errors are given and link loops into the node

$
0
0

Problem/Motivation

I had to use protocol-less URL in my content and drupal allowed me to save my content without giving any errors and not even a log message.

After saving I checked my node and clicked in the link I've just created. The page loops to itself.

STEPS to reproduce:

  1. Add field of the type 'link' in article content type
  2. Add a content of the type 'Article'
  3. In the link field, add a link like: '//www.google.com'
  4. Hit save and check the node
  5. Click on the link saved

Actual result:

The link redirects to the page itself.

OBS: I noticed the problem on 8.3.4 version. We could check if the problem exists on dev version.

Proposed resolution

Given that Link module in D7 doesn't allow you to use protocol-less urls, and a error are displayed to the user, we could add this to D8 also. Think about people that doesn't know about protocol-less and are trying to use in their contents, if they don't check the link properly, the link will redirects to the nade itself. So , if it's prossible:

a) Add a drupal error saying to the users that he can't use those kinds of URLs, or

b) Allow the use of these URLs.

And we could add a event log to the log messages.

Viewing all 291721 articles
Browse latest View live


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