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

Add a public API for aliasing resource type names

$
0
0

Problem/Motivation

JSON:API has \Drupal\jsonapi\ResourceType\ResourceTypeBuildEvent to allow fields to be aliased, fields to be disabled and resource types to be disabled. Those were the three first public PHP APIs for the jsonapi module.

A logical next one would be to allow resource types to be aliased.

Related: @bojanz in #3032787-21: [META] Start creating the public PHP API of the JSON:API module.

Proposed resolution

  1. Allow entity types to declare a JSON:API resource type name using a jsonapi_resource_type_name entity type annotation key.
  2. Add a new method to \Drupal\jsonapi\ResourceType\ResourceTypeBuildEvent.

(Option 2 is preferred by @e0ipso, @gabesullice and @Wim Leers because it solved more problems: it allows any module to override it. So: more power, more consistency, smaller API surface.)

Remaining tasks

User interface changes

None.

API changes

A new method on \Drupal\jsonapi\ResourceType\ResourceTypeBuildEvent.

Data model changes

None.

Release notes snippet

TBD


Some menu links not aliased on the homepage

$
0
0

Hello,

I hope report the right bug with the right Drupal 8 component (Drupal 8.9.1).

I have notice that (some) menu links are not aliased on the homepage. I have lost a lot of time with this bug, but I have found a workaround. Here I explain this bug and the solution I have found temporaly: https://www.drupal.org/forum/support/post-installation/2020-06-20/menu-l...

I hope it helps and sorry if you can not reproduice.

Regards

Path comparison (e.g. for block visiblity) doesn't work for aliased internal paths with capital letters (block_block_list_alter() in D7)

$
0
0

Short description of the problem: both sides of the string comparison must be lowercased, but the (system) path isn't lowercased…

D7 + D8 are affected by this bug.

-----

API page: https://api.drupal.org/api/drupal/modules%21block%21block.module/functio...

When the path patterns are compared with the current path the block_block_list_alter() function says:

// Compare the lowercase internal and lowercase path alias (if any).

For the comparison of the aliased path everything is fine. But in the 2nd comparison with the internal path there is a missing drupal_strtolower() call for the internal path ($_GET['q']).

So the bugfix would be an easy replacement of the line
$page_match = $page_match || drupal_match_path($_GET['q'], $pages);
with
$page_match = $page_match || drupal_match_path(drupal_strtolower($_GET['q']), $pages);
.

Or is there any mechanism that "auto"-lowercases $_GET['q']? I don't know such a mechanism...

To reproduce the bug create an internal path (e.g. for a Views page or with hook_menu()) that contains at least 1 capital letter. Create an URL alias for that path. Enter the internal path as visibility page for any block and check that the block visibilty doesn't work as expected.

Support PHPUnit 9 optionally in Drupal 9, while keeping support for ^8.4

Support non-primitive typed data as resource object field values

$
0
0

Problem/Motivation

\Drupal\jsonapi\Normalizer\ResourceObjectNormalizer::serializeField in the JSON:API resource object normalizer doesn't normalize values unless they are FieldItemListInterface instances or primitive data values. This is due to the tight coupling to the entity system:

  • Content entity properties are always instances of FieldItemListInterface
  • Config entity properties are always primitive values

Drupal has a robust TypedData API, which the entity field system builds on top of. We should be able to construct resource objects from this same TypedData API. Doing so helps pave the way to remove the tight decoupling of JSON:API from the entity system

We are using a decorated serializer.normalizer.resource_object.jsonapi in Commerce API to allow returning value objects over the API, which are not entities.

Proposed resolution

The following in the ResourceObjectNormalizer::serializeField provides a catch-all for values that are TypedData.

    if ($field instanceof TypedDataInterface) {
      return CacheableNormalization::permanent($this->serializer->normalize($field, $format, $context));
    }

Currently, this is only useful if you're using JSON:API Resources to build your own resource endpoints.

Remaining tasks

Patch and test

User interface changes

N/A

API changes

🥳 You can now build a resource object using typed data values, like in Commerce API!

Data model changes

N/A

Release notes snippet

[META] Roadmap to stabilize Olivero

$
0
0

Problem/Motivation

The Drupal core Bartik theme was released as part of Drupal 7 in January 2011, 9 years ago. It was great! It also stayed pretty much the same ever since and been included with Drupal 8 as well and potentially will be the default theme of Drupal 9 even. The web moved forward a whole lot in 9 years and Bartik is not doing justice to Drupal anymore. It was great in 2011, it is not great anymore.

Proposed resolution

Drupal 9 needs a new default frontend theme. A new, modern, clean frontend theme, Olivero is being built in the contributed project https://www.drupal.org/project/olivero for inclusion in Drupal core. This issue is to gather requirements for Drupal core inclusion.

Olivero Theme

Designs are at #3088378: Designs for new front-end theme for Drupal 9.

Olivero “beta” criteria

Once the following level of feature completeness has been reached, we will consider tagging beta release for Olivero:

Must-haves for the beta release:

Features
Accessibility
Design/Usability improvements
Bugs
Technical debt
Core inclusion/Dependencies

Olivero “stable” criteria

Once the following level of feature completeness has been reached, we will consider tagging stable release for Olivero:

Must-have issues for stable release:

Features
Accessibility
Design/Usability improvements
Bugs
Technical debt
Core inclusion/Dependencies
Post-stable

Olivero Staging Preview

Preview Link: https://bit.ly/olivero-tugboat

User interface changes

A new default frontend theme.
New image style for the standard profile: #3153009: Create "Wide" image style for standard profile

API changes

None.

Data model changes

None.

Release notes snippet

A new modern, clear frontend theme has been added to Drupal core called Oliver. (continue TBD)

Ability to Subtheme

Subtheming Olivero will not be initially supported, but we may include formal support in the future. That being said, if we find simple issues that can lead us toward making this more simple, we will commit them.

Timeline

Disclaimer: I have no idea what I'm doing as far as core timelines and tend to be optimistic in my estimations

- Now: As of June 18th, 2020, we're on alpha3. We plan on releasing alpha4 on the week of June 29. release.
- Week of July 3 First beta. The beta will concentrate on
- Accessibility
- Coding standards
- The process to get into core
- Every one to two weeks: new beta

I'm not sure what's involved to get this into core, or if it can go straight to stable, but we hope to have it ready for inclusion by early August going into the core as stable. If we do not meet these criteria, it can go into the core as experimental.

Replace usages of \Drupal::pathValidator() with IoC injection

Convert schema.inc to a service

$
0
0

Problem/Motivation

Convert the schema.inc functions to a service so it can be injected, unit tested and swapped. Affected functions:

  • drupal_get_schema_versions()
  • drupal_get_installed_schema_version()
  • drupal_set_installed_schema_version()

This functions are like a registry for last executed update function per module which is statically cached (clean-up of drupal_static() is second win here

The remaining functions should fall into the scope of extension services and processed in #2908886: Split off schema management out of schema.inc

  • drupal_get_module_schema()
  • drupal_install_schema()
  • drupal_uninstall_schema()
  • _drupal_schema_initialize()

Already removed in https://www.drupal.org/node/2467521

  • drupal_get_schema()
  • drupal_get_complete_schema()
  • drupal_get_schema_unprocessed()

drupal_schema_get_field_value() Fixed in #3051981: Deprecate drupal_schema_get_field_value()

Proposed resolution

Create a schema service with methods that replace the mentioned functions in schema.inc.

Remaining tasks

Deprecate the functions changed by this issue. https://www.drupal.org/core/deprecation#how-function

Move the extension-related functions into extension services. Follow-up or find child issue here: #2186491: [meta] D8 Extension System: Discovery/Listing/Info

User interface changes

None

API changes

New Schema service with the following methods:

  • get
  • getComplete
  • getVersions
  • getInstalledVersion
  • setInstalledVersion
  • install
  • uninstall
  • getUnprocessed
  • getFieldsSqlgetFieldValue

FieldItemNormalizer to not flatten if one property and getMainPropertyName is NULL

$
0
0

Problem/Motivation

JSON:API has a nice feature in that it flattens a Drupal field value so we don't have pesky value sub-properties on things like string, boolean, email, etc fields. This is great, except when you want your field type to have a forced sub-property.

In the Commerce API module being developed we have a billing_information field that has at least an address property and may have more, such as a tax number or phone number.

Currently, the billing_information field just displays all of the address item values as root properties, causing a broken schema.

The relevant code is: https://git.drupalcode.org/project/drupal/blob/8.8.x/core/modules/jsonap...

      $field_properties = TypedDataInternalPropertiesHelper::getNonInternalProperties($field_item);
      // Flatten if there is only a single property to normalize.
      $values = static::rasterizeValueRecursive(count($field_properties) == 1 ? reset($values) : $values);

getNonInternalProperties will return properties that are not computed or marked internal.

I had to make this workaround for myself:

  /**
   * {@inheritdoc}
   */
  public function normalize($object, $format = NULL, array $context = []) {
    assert($object instanceof Address);
    // Work around for JSON:API's normalization of FieldItems. If there is only
    // one root property in the field item, it will flatten the values. We do
    // not want that for the OrderProfile field, as `address` should be present.
    // This only happens if there is one field on the profile.
    // @see \Drupal\jsonapi\Normalizer\FieldItemNormalizer::normalize
    // @todo open issue FieldItemNormalizer::normalize should ignore if mainPropertyName is NULL.
    $parent = $object->getParent();
    if ($parent instanceof OrderProfile) {
      $field_properties = TypedDataInternalPropertiesHelper::getNonInternalProperties($parent);
      if (count($field_properties) === 1) {
        // This ensures the value is always under an `address` property.
        return ['address' => array_filter($object->getValue())];
      }
    }
    return array_filter($object->getValue());
  }

Proposed resolution

If there is one property returned by TypedDataInternalPropertiesHelper::getNonInternalProperties, check if it matches the main property value. In most cases it will, or getMainPropertyName wil be NULL. If it doesn't match, then do not flatten the field values. Often times getMainPropertyName returns NULL If the field type has multiple properties for its value and there cannot be a single property used (ie: price field, you need the number and currency.)

Remaining tasks

User interface changes

None.

API changes

JSON:API will no longer flatten field types which return NULL or a main property name which does not match the single property returned.

Data model changes

None.

Release notes snippet

[META] Resolve Symfony 4 deprecations (Symfony 5 compatibility)

$
0
0

Problem/Motivation

In August 2019 Fabian Potencier announced at https://symfony.com/blog/symfony-maintenance-changes-for-standard-releases that

As of Symfony 5.0, we are changing the way we manage security issues for standard releases. A standard release is any minor version that is not a LTS release: so, versions X.0, X.1, x.2, and x.3.

For these standard releases, we will align the EOM (end of maintenance) date with the EOL (end of life) date. So, instead of having 14 months of security fixes, we will only have 8 months.

For instance, Symfony 4.3 EOM date is January 2020 and EOL date is July 2020. With the new rules, EOL would have been January 2020. Symfony 5.0 will be the first release to implement the change: EOM and EOL dates will be July 2020.

Therefore, to be able to support Drupal minor releases for 12 months, Drupal 9 choose to rely on Symfony 4.4. That said, Symfony 5 is already out and it may be possible to make Drupal 9 both Symfony 4.4 and Symfony 5 compatible. This issue is to explore to do that as much as possible. This will be very useful in the transition to Drupal 10 as well, which is planned to be released on Symfony 5.4 Long Term Support.

See #2976394: Allow Symfony 4.4 to be installed in Drupal 8 for prior art with Symfony 4 on Drupal 8.

Proposed resolution

See children issues.

Remaining tasks

Three issues for EventDispatcher:

#3055198: [Symfony 5] Symfony/Component/EventDispatcher/Event is deprecated in Symfony 4.3 use Symfony/Contracts/EventDispatcher/Event instead

#3055194: [Symfony 5] The signature of the "Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::dispatch()" method should be updated to "dispatch($event, string $eventName = null)", not doing so is deprecated since Symfony 4.3.

(follow-up, not a hard blocker here:) #3153803: [PP-2] Find a way to notify people about Symfony Event class changes

One issue for MimeTypes:

#3055193: [Symfony 5] The "Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser" class is deprecated since Symfony 4.3, use "Symfony\Component\Mime\MimeTypes" instead.

User interface changes

None.

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

drupal_http_request fails when remote server is using openssl v1.0.0

$
0
0

When trying to make a drupal_http_request over HTTPS from a site running PHP 5.3 (openSSL v0.9.8b) and the remote server is running openSSL v1.0.0 or newer the certificate version negotiation fails.

The internal error is: OpenSSL Error messages: error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:reason(1112)

The solution is to define the transport/ssl certificate version expected. The PHP documentation has this definition: ssl:// will attempt to negotiate an SSL V2, or SSL V3 connection depending on the capabilities and preferences of the remote host. sslv2:// and sslv3:// will select the SSL V2 or SSL V3 protocol explicitly.

Change Header Status Response to 410

$
0
0

Hi,

I have several urls with "/tag/" string; some of them have content and some of them don't so they return 404.

How can I force them to return a 410 only for those that have no content?

I need a filter: has "/tag/" in URL and returns 404 -> redirect to 410.

I tried in theme_preprocess_html(&$variables) like this:

if ($pattern2){ //it has "/tag/" string
      $status = \Drupal::requestStack()->getCurrentRequest()->attributes->get('exception');      
      if ($status && $status->getStatusCode() == 404){
          $response = new Response();
          $response->setStatusCode(410);
          return $response;
      }
}

It filters ok but nothing happens. Still 404

Thank you for your help!!

Fix "Drupal" typos in core

$
0
0

Problem/Motivation

#2972224: Add .cspell.json to automate spellchecking in Drupal core landed, we can use cspell to check spelling errors now.

As title, this one is to fix "Drupal" related typos.

(This is a novice issue field for @jeffp)

Proposed resolution

  • Search "D rural" and replace/correct them with "Drupal"
  • Remove the typo "rural" from the dictionary file core/misc/cspell/dictionary.txt

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Improve StringItem::generateSampleValue()

$
0
0

Problem/Motivation

Sample entity value generation generates long strings for text fields. This can cause the layout to break, as noted in #3016507: Break long text strings in layout edit

Proposed resolution

Rather than use \Drupal\Component\Utility\Random::word, which often generates very long words, use \Drupal\Component\Utility\Random::paragraphs, which uses words from a selection of shorter words.

Remaining tasks

Write a patch.

User interface changes

None-ish.

API changes

None

Data model changes

None

Re-index site not working

$
0
0

Hi

On this page, /admin/config/search/pages, when I try to reindex the site, it says "0% of the site has been indexed. There are 8822 items left to index."

Even I ran the cron, However, the issues not fixed. Please find the attached screenshot.

Could anyone look into it and let me know the way to fix it.

Thanks


Implement new Gray scale on Claro

$
0
0

Problem/Motivation

Right now we have a limited amount of greys on the design system and they don't have enough middle steps for some situations. Also, each of them has a different tone.

Proposed resolution

Implement the new redesigned Grey scale with new colors and previous colors adjusted.

Also it should be discussed which color we should finally use for the disabled elements.

Link to Figma specs: https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Drupal-Design-system...

Remaining tasks

  • Update the color variables
  • Replace existing colors
  • Decide which color to use for disabled

User interface changes

All grey colors will change.

Release notes snippet

[Symfony 5] The "Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser" class is deprecated since Symfony 4.3, use "Symfony\Component\Mime\MimeTypes" instead.

$
0
0

Problem/Motivation

Resolve the following SF4 Deprecations if possible:

'The "Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser" class is deprecated since Symfony 4.3, use "Symfony\Component\Mime\MimeTypes" instead.'

'The "Drupal\Core\File\MimeType\MimeTypeGuesser" class implements "Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface" that is deprecated since Symfony 4.3, use {@link MimeTypesInterface} instead.'

'The "Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser" class is deprecated since Symfony 4.3, use "Symfony\Component\Mime\FileBinaryMimeTypeGuesser" instead.'

'The "Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser" class is deprecated since Symfony 4.3, use "Symfony\Component\Mime\FileinfoMimeTypeGuesser" instead.'

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Illegal choice in grouped exposed filters with enabled option remember (ListField, BooleanOperator - Views filter handlers )

$
0
0

First issue:
When using a list field as an exposed grouped filter with the checkbox to remember selections, I get the following error: "An illegal choice has been detected. Please contact the site administrator.":

illegal_choice

Filter settings:

list field settings 1
list field settings 2

Second issue:
When using a Boolean field as an exposed grouped filter with the checkbox to remember selections, I get the following error: "An illegal choice has been detected. Please contact the site administrator.":

boolean settings 1
boolean settings 2

Steps to reproduce:
- Import configs
- Add 6 nodes with filled fields (list_field_test: 2(Nodes) - Active, 2 - Inactive, 2 - Locked and test_status: 3 - Published, 3 - Unpublished)
- Go to path /test_list_view
- Select filters:
List Field Test (Inactive), Test Status (Not Published)
or
List Field Test (Inactive), Test Status (- Any -)
- Submit search
- Go to any path
- Again go to path /test_list_view

In different variations of the search query - we get an error:
An illegal choice has been detected. Please contact the site administrator.

Replace method names that use writeable with writable

$
0
0

Problem/Motivation

This is a followup to #2898947: Change "writeable" to "writable". Where that ticket covers the documentation, a follow-up was requested to cover changes to the method names. This is that follow-up.

Drupal core defines three functions with the less-used spelling 'writeable'...

The PHP standard library has a function named is_writable(), which Core uses 36 times; and an alias of that function named is_writeable(), which core does not use (as of commit 3834d60f1a).

Given that 'writable' already occurs more often than 'writeable', it makes sense for us change to 'writable' in this patch.

Proposed resolution

  1. Create new versions of the methods spelled "writable".
  2. Update the old versions to be wrappers of the new ones.
  3. Deprecate the old ones.

Remaining tasks

  1. Write a patch.
  2. Review by searching latest code with grep -r 'writeable' /path/to/core.

API changes

The following instances will be replaced/deprecated:

  1. \Drupal\Component\PhpStorage\PhpStorageInterface::writeable()
  2. \Drupal\Component\PhpStorage\FileStorage::writeable()
  3. \Drupal\Component\PhpStorage\FileReadOnlyStorage::writeable()

Data model changes

N/A

Release notes snippet

N/A

Do Files Degrade From Viewing Only?

$
0
0

1. Assuming that the hardware is brand new and proven 100% functional, does anybody know if Adobe Illustrator's files will degrade only from viewing them without making any edits, changes, resavings? Or for that matter, is there any adobe product that will cause file degradation only from viewing it without making any edits, changes, or resaving? My lead at work says that it will but I disagree with this.

2. Also, when copying a file (e.g. .pdf, .jpg, or .mp3), then making a copy of the copy, and then making yet another copy of the last copied file, and then repeating this process multiple times, would it ever cause the last copy to degrade? My lead also says yes, but I disagree. The way I explained this is that when we copy files, we're duplicating 0s and 1s, and as long as there is no hardware or software damage or issues, the last copy will always be the same as the original file.

Viewing all 300252 articles
Browse latest View live


Latest Images

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